Repository: facebook/yoga Branch: main Commit: 0a2398d532e1 Files: 465 Total size: 11.2 MB Directory structure: gitextract_lqavlrcu/ ├── .clang-format ├── .clang-tidy ├── .editorconfig ├── .eslintrc.cjs ├── .github/ │ ├── ISSUE_TEMPLATE.md │ ├── actions/ │ │ ├── black/ │ │ │ └── action.yml │ │ ├── cache-emsdk/ │ │ │ └── action.yml │ │ ├── install-ninja/ │ │ │ └── action.yml │ │ ├── setup-android/ │ │ │ └── action.yml │ │ ├── setup-apple/ │ │ │ └── action.yml │ │ ├── setup-cpp/ │ │ │ └── action.yml │ │ └── setup-js/ │ │ └── action.yml │ └── workflows/ │ ├── publish-android-release.yml │ ├── publish-android-snashot.yml │ ├── publish-npm-release.yml │ ├── validate-android.yml │ ├── validate-cpp.yml │ ├── validate-js.yml │ ├── validate-swiftpm.yml │ ├── validate-tests.yml │ └── validate-website.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.js ├── .vscode/ │ ├── extensions.json │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── LICENSE-examples ├── Package.swift ├── README.md ├── benchmark/ │ ├── Benchmark.cpp │ ├── Benchmark.h │ ├── CMakeLists.txt │ ├── TreeDeserialization.cpp │ ├── TreeDeserialization.h │ ├── YGBenchmark.c │ ├── benchmark │ └── captures/ │ ├── chat-mac.json │ ├── feed-android.json │ ├── profile-ios.json │ └── rendering-sample-mac.json ├── build.gradle ├── build_fuzz_tests ├── capture/ │ ├── CMakeLists.txt │ ├── CaptureTree.cpp │ ├── CaptureTree.h │ ├── NodeToString.cpp │ └── NodeToString.h ├── cmake/ │ ├── project-defaults.cmake │ └── yoga-config.cmake.in ├── enums.py ├── fuzz/ │ ├── CMakeLists.txt │ └── FuzzLayout.cpp ├── gentest/ │ ├── babel.config.cjs │ ├── fixtures/ │ │ ├── YGAbsolutePositionTest.html │ │ ├── YGAlignContentTest.html │ │ ├── YGAlignItemsTest.html │ │ ├── YGAlignSelfTest.html │ │ ├── YGAndroidNewsFeed.html │ │ ├── YGAspectRatioTest.html │ │ ├── YGAutoTest.html │ │ ├── YGBorderTest.html │ │ ├── YGBoxSizingTest.html │ │ ├── YGDimensionTest.html │ │ ├── YGDisplayTest.html │ │ ├── YGFlexBasisFitContentTest.html │ │ ├── YGFlexDirectionTest.html │ │ ├── YGFlexTest.html │ │ ├── YGFlexWrapTest.html │ │ ├── YGGapTest.html │ │ ├── YGIntrinsicSizeTest.html │ │ ├── YGJustifyContentTest.html │ │ ├── YGMarginTest.html │ │ ├── YGMinMaxDimensionTest.html │ │ ├── YGPaddingTest.html │ │ ├── YGPercentageTest.html │ │ ├── YGRoundingTest.html │ │ ├── YGSizeOverflowTest.html │ │ └── YGStaticPositionTest.html │ ├── gentest-driver.ts │ ├── gentest-validate.ts │ ├── package.json │ ├── scripts/ │ │ └── gentest-validate.ts │ ├── signedsource.d.ts │ ├── src/ │ │ ├── ChromePool.ts │ │ ├── CssToYoga.ts │ │ ├── buildLayoutTree.ts │ │ ├── cli.ts │ │ ├── emitters/ │ │ │ ├── CppEmitter.ts │ │ │ ├── Emitter.ts │ │ │ ├── JavaEmitter.ts │ │ │ └── JavascriptEmitter.ts │ │ └── types.ts │ ├── test-template.html │ └── tsconfig.json ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── java/ │ ├── AndroidManifest.xml │ ├── CMakeLists.txt │ ├── build.gradle.kts │ ├── com/ │ │ └── facebook/ │ │ └── yoga/ │ │ ├── LayoutPassReason.kt │ │ ├── YogaAlign.java │ │ ├── YogaBaselineFunction.kt │ │ ├── YogaBoxSizing.java │ │ ├── YogaConfig.kt │ │ ├── YogaConfigFactory.kt │ │ ├── YogaConfigJNIBase.kt │ │ ├── YogaConfigJNIFinalizer.kt │ │ ├── YogaConstants.kt │ │ ├── YogaDimension.java │ │ ├── YogaDirection.kt │ │ ├── YogaDisplay.java │ │ ├── YogaEdge.java │ │ ├── YogaErrata.java │ │ ├── YogaExperimentalFeature.java │ │ ├── YogaFlexDirection.java │ │ ├── YogaGridTrackType.java │ │ ├── YogaGutter.java │ │ ├── YogaJustify.java │ │ ├── YogaLayoutType.kt │ │ ├── YogaLogLevel.java │ │ ├── YogaLogger.kt │ │ ├── YogaMeasureFunction.kt │ │ ├── YogaMeasureMode.java │ │ ├── YogaMeasureOutput.kt │ │ ├── YogaNative.kt │ │ ├── YogaNode.kt │ │ ├── YogaNodeFactory.kt │ │ ├── YogaNodeJNIBase.java │ │ ├── YogaNodeJNIFinalizer.kt │ │ ├── YogaNodeType.java │ │ ├── YogaOverflow.java │ │ ├── YogaPositionType.java │ │ ├── YogaProps.kt │ │ ├── YogaStyleInputs.kt │ │ ├── YogaUnit.java │ │ ├── YogaValue.kt │ │ ├── YogaWrap.java │ │ └── annotations/ │ │ └── DoNotStrip.kt │ ├── gen/ │ │ └── com/ │ │ └── facebook/ │ │ └── yoga/ │ │ └── BuildConfig.java │ ├── jni/ │ │ ├── LayoutContext.cpp │ │ ├── LayoutContext.h │ │ ├── ScopedGlobalRef.h │ │ ├── ScopedLocalRef.h │ │ ├── YGJNI.h │ │ ├── YGJNIVanilla.cpp │ │ ├── YGJNIVanilla.h │ │ ├── YGJTypesVanilla.h │ │ ├── YogaJniException.cpp │ │ ├── YogaJniException.h │ │ ├── common.cpp │ │ ├── common.h │ │ ├── corefunctions.cpp │ │ ├── corefunctions.h │ │ ├── macros.h │ │ └── yogajni.cpp │ ├── proguard-rules.pro │ ├── res/ │ │ └── values/ │ │ └── strings.xml │ ├── tests/ │ │ ├── com/ │ │ │ └── facebook/ │ │ │ └── yoga/ │ │ │ ├── TestParametrization.java │ │ │ ├── YGAlignBaselineTest.java │ │ │ ├── YogaExceptionTest.java │ │ │ ├── YogaLoggerTest.java │ │ │ ├── YogaNodeStylePropertiesTest.java │ │ │ ├── YogaNodeTest.java │ │ │ ├── YogaValueTest.java │ │ │ └── utils/ │ │ │ └── TestUtils.java │ │ └── generated/ │ │ └── com/ │ │ └── facebook/ │ │ └── yoga/ │ │ ├── YGAbsolutePositionTest.java │ │ ├── YGAlignContentTest.java │ │ ├── YGAlignItemsTest.java │ │ ├── YGAlignSelfTest.java │ │ ├── YGAndroidNewsFeed.java │ │ ├── YGAspectRatioTest.java │ │ ├── YGAutoTest.java │ │ ├── YGBorderTest.java │ │ ├── YGBoxSizingTest.java │ │ ├── YGDimensionTest.java │ │ ├── YGDisplayContentsTest.java │ │ ├── YGDisplayTest.java │ │ ├── YGFlexBasisFitContentTest.java │ │ ├── YGFlexDirectionTest.java │ │ ├── YGFlexTest.java │ │ ├── YGFlexWrapTest.java │ │ ├── YGGapTest.java │ │ ├── YGIntrinsicSizeTest.java │ │ ├── YGJustifyContentTest.java │ │ ├── YGMarginTest.java │ │ ├── YGMinMaxDimensionTest.java │ │ ├── YGPaddingTest.java │ │ ├── YGPercentageTest.java │ │ ├── YGRoundingTest.java │ │ ├── YGSizeOverflowTest.java │ │ └── YGStaticPositionTest.java │ └── yogajni.version ├── javascript/ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── README.md │ ├── babel.config.cjs │ ├── jest.config.js │ ├── jest.setup.js │ ├── just.config.cjs │ ├── package.json │ ├── src/ │ │ ├── generated/ │ │ │ └── YGEnums.ts │ │ ├── index.ts │ │ ├── load.ts │ │ ├── wasm_bridge.c │ │ └── wrapAssembly.ts │ ├── tests/ │ │ ├── Benchmarks/ │ │ │ └── YGBenchmark.test.ts │ │ ├── YGAlignBaselineTest.test.ts │ │ ├── YGComputedBorderTest.test.ts │ │ ├── YGComputedMarginTest.test.ts │ │ ├── YGComputedPaddingTest.test.ts │ │ ├── YGDirtiedTest.test.ts │ │ ├── YGErrataTest.test.ts │ │ ├── YGFlexBasisAuto.test.ts │ │ ├── YGHasNewLayout.test.ts │ │ ├── YGMeasureCacheTest.test.ts │ │ ├── YGMeasureTest.test.ts │ │ ├── bin/ │ │ │ └── run-bench.ts │ │ ├── generated/ │ │ │ ├── YGAbsolutePositionTest.test.ts │ │ │ ├── YGAlignContentTest.test.ts │ │ │ ├── YGAlignItemsTest.test.ts │ │ │ ├── YGAlignSelfTest.test.ts │ │ │ ├── YGAndroidNewsFeed.test.ts │ │ │ ├── YGAspectRatioTest.test.ts │ │ │ ├── YGAutoTest.test.ts │ │ │ ├── YGBorderTest.test.ts │ │ │ ├── YGBoxSizingTest.test.ts │ │ │ ├── YGDimensionTest.test.ts │ │ │ ├── YGDisplayContentsTest.test.ts │ │ │ ├── YGDisplayTest.test.ts │ │ │ ├── YGFlexBasisFitContentTest.test.ts │ │ │ ├── YGFlexDirectionTest.test.ts │ │ │ ├── YGFlexTest.test.ts │ │ │ ├── YGFlexWrapTest.test.ts │ │ │ ├── YGGapTest.test.ts │ │ │ ├── YGIntrinsicSizeTest.test.ts │ │ │ ├── YGJustifyContentTest.test.ts │ │ │ ├── YGMarginTest.test.ts │ │ │ ├── YGMinMaxDimensionTest.test.ts │ │ │ ├── YGPaddingTest.test.ts │ │ │ ├── YGPercentageTest.test.ts │ │ │ ├── YGRoundingTest.test.ts │ │ │ ├── YGSizeOverflowTest.test.ts │ │ │ └── YGStaticPositionTest.test.ts │ │ └── tools/ │ │ ├── MeasureCounter.ts │ │ ├── globals.ts │ │ └── utils.ts │ └── tsconfig.json ├── lib/ │ ├── jni/ │ │ ├── jni.h │ │ └── real/ │ │ └── jni.h │ ├── jsr-305/ │ │ └── jsr305.jar │ ├── nlohmann/ │ │ └── json.hpp │ └── soloader/ │ └── soloader-0.5.1.aar ├── package.json ├── set-version.py ├── settings.gradle.kts ├── tests/ │ ├── .clang-tidy │ ├── CMakeLists.txt │ ├── EventsTest.cpp │ ├── FlexGapTest.cpp │ ├── FloatOptionalTest.cpp │ ├── OrdinalsTest.cpp │ ├── SmallValueBufferTest.cpp │ ├── StyleTest.cpp │ ├── StyleValuePoolTest.cpp │ ├── YGAlignBaselineTest.cpp │ ├── YGAspectRatioTest.cpp │ ├── YGBaselineFuncTest.cpp │ ├── YGCloneNodeTest.cpp │ ├── YGComputedMarginTest.cpp │ ├── YGComputedPaddingTest.cpp │ ├── YGConfigTest.cpp │ ├── YGDefaultValuesTest.cpp │ ├── YGDirtiedTest.cpp │ ├── YGDirtyMarkingTest.cpp │ ├── YGEdgeTest.cpp │ ├── YGFlexBasisFitContentTest.cpp │ ├── YGHadOverflowTest.cpp │ ├── YGLayoutableChildrenTest.cpp │ ├── YGMeasureCacheTest.cpp │ ├── YGMeasureModeTest.cpp │ ├── YGMeasureTest.cpp │ ├── YGNodeCallbackTest.cpp │ ├── YGNodeChildTest.cpp │ ├── YGPersistenceTest.cpp │ ├── YGPersistentNodeCloningTest.cpp │ ├── YGRelayoutTest.cpp │ ├── YGRoundingFunctionTest.cpp │ ├── YGRoundingMeasureFuncTest.cpp │ ├── YGScaleChangeTest.cpp │ ├── YGStyleTest.cpp │ ├── YGTreeMutationTest.cpp │ ├── YGValueTest.cpp │ ├── YGZeroOutLayoutRecursivelyTest.cpp │ ├── generated/ │ │ ├── YGAbsolutePositionTest.cpp │ │ ├── YGAlignContentTest.cpp │ │ ├── YGAlignItemsTest.cpp │ │ ├── YGAlignSelfTest.cpp │ │ ├── YGAndroidNewsFeed.cpp │ │ ├── YGAspectRatioTest.cpp │ │ ├── YGAutoTest.cpp │ │ ├── YGBorderTest.cpp │ │ ├── YGBoxSizingTest.cpp │ │ ├── YGDimensionTest.cpp │ │ ├── YGDisplayContentsTest.cpp │ │ ├── YGDisplayTest.cpp │ │ ├── YGFlexBasisFitContentTest.cpp │ │ ├── YGFlexDirectionTest.cpp │ │ ├── YGFlexTest.cpp │ │ ├── YGFlexWrapTest.cpp │ │ ├── YGGapTest.cpp │ │ ├── YGIntrinsicSizeTest.cpp │ │ ├── YGJustifyContentTest.cpp │ │ ├── YGMarginTest.cpp │ │ ├── YGMinMaxDimensionTest.cpp │ │ ├── YGPaddingTest.cpp │ │ ├── YGPercentageTest.cpp │ │ ├── YGRoundingTest.cpp │ │ ├── YGSizeOverflowTest.cpp │ │ └── YGStaticPositionTest.cpp │ └── util/ │ ├── TestUtil.cpp │ └── TestUtil.h ├── unit_tests ├── unit_tests.bat ├── website/ │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── README.md │ ├── babel.config.cjs │ ├── blog/ │ │ ├── 2023-06-30-announcing-yoga-2.0.md │ │ ├── 2024-06-24-announcing-yoga-3.1.md │ │ ├── 2024-12-02-announcing-yoga-3.2.md │ │ ├── authors.yml │ │ └── yoga-3-release/ │ │ └── 2024-03-14-announcing-yoga-3.0.md │ ├── docs/ │ │ ├── about-yoga.md │ │ ├── advanced/ │ │ │ ├── _category_.json │ │ │ ├── containing-block.md │ │ │ ├── external-layout-systems.mdx │ │ │ └── incremental-layout.mdx │ │ ├── getting-started/ │ │ │ ├── _category_.json │ │ │ ├── configuring-yoga.mdx │ │ │ └── laying-out-a-tree.mdx │ │ └── styling/ │ │ ├── _category_.json │ │ ├── align-content.mdx │ │ ├── align-items-self.mdx │ │ ├── aspect-ratio.mdx │ │ ├── display.mdx │ │ ├── flex-basis-grow-shrink.mdx │ │ ├── flex-direction.mdx │ │ ├── flex-wrap.mdx │ │ ├── gap.mdx │ │ ├── index.md │ │ ├── insets.mdx │ │ ├── justify-content.mdx │ │ ├── layout-direction.mdx │ │ ├── margin-padding-border.mdx │ │ ├── min-max-width-height.mdx │ │ ├── position.mdx │ │ └── width-height.mdx │ ├── docusaurus.config.js │ ├── package.json │ ├── sidebars.cjs │ ├── src/ │ │ ├── components/ │ │ │ ├── EditorToolbar.module.css │ │ │ ├── EditorToolbar.tsx │ │ │ ├── FlexStyle.ts │ │ │ ├── LayoutBox.module.css │ │ │ ├── LayoutBox.tsx │ │ │ ├── Playground.module.css │ │ │ ├── Playground.tsx │ │ │ └── YogaViewer.tsx │ │ ├── css/ │ │ │ └── custom.css │ │ └── pages/ │ │ ├── index.module.css │ │ ├── index.tsx │ │ ├── markdown-page.md │ │ ├── playground.module.css │ │ └── playground.tsx │ ├── static/ │ │ └── .nojekyll │ └── tsconfig.json └── yoga/ ├── CMakeLists.txt ├── YGConfig.cpp ├── YGConfig.h ├── YGEnums.cpp ├── YGEnums.h ├── YGMacros.h ├── YGNode.cpp ├── YGNode.h ├── YGNodeLayout.cpp ├── YGNodeLayout.h ├── YGNodeStyle.cpp ├── YGNodeStyle.h ├── YGPixelGrid.cpp ├── YGPixelGrid.h ├── YGValue.cpp ├── YGValue.h ├── Yoga.h ├── algorithm/ │ ├── AbsoluteLayout.cpp │ ├── AbsoluteLayout.h │ ├── Align.h │ ├── Baseline.cpp │ ├── Baseline.h │ ├── BoundAxis.h │ ├── Cache.cpp │ ├── Cache.h │ ├── CalculateLayout.cpp │ ├── CalculateLayout.h │ ├── FlexDirection.h │ ├── FlexLine.cpp │ ├── FlexLine.h │ ├── PixelGrid.cpp │ ├── PixelGrid.h │ ├── SizingMode.h │ └── TrailingPosition.h ├── config/ │ ├── Config.cpp │ └── Config.h ├── debug/ │ ├── AssertFatal.cpp │ ├── AssertFatal.h │ ├── Log.cpp │ └── Log.h ├── enums/ │ ├── Align.h │ ├── BoxSizing.h │ ├── Dimension.h │ ├── Direction.h │ ├── Display.h │ ├── Edge.h │ ├── Errata.h │ ├── ExperimentalFeature.h │ ├── FlexDirection.h │ ├── GridTrackType.h │ ├── Gutter.h │ ├── Justify.h │ ├── LogLevel.h │ ├── MeasureMode.h │ ├── NodeType.h │ ├── Overflow.h │ ├── PhysicalEdge.h │ ├── PositionType.h │ ├── Unit.h │ ├── Wrap.h │ └── YogaEnums.h ├── event/ │ ├── event.cpp │ └── event.h ├── module.modulemap ├── node/ │ ├── CachedMeasurement.h │ ├── LayoutResults.cpp │ ├── LayoutResults.h │ ├── LayoutableChildren.h │ ├── Node.cpp │ └── Node.h ├── numeric/ │ ├── Comparison.h │ └── FloatOptional.h └── style/ ├── GridLine.h ├── GridTrack.h ├── SmallValueBuffer.h ├── Style.h ├── StyleLength.h ├── StyleSizeLength.h ├── StyleValueHandle.h └── StyleValuePool.h ================================================ FILE CONTENTS ================================================ ================================================ FILE: .clang-format ================================================ AccessModifierOffset: -1 AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveMacros: false AlignConsecutiveAssignments: false AlignConsecutiveBitFields: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left AlignOperands: DontAlign AlignTrailingComments: false AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false AllowShortEnumsOnASingleLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false BreakBeforeBinaryOperators: None BreakBeforeBraces: Attach BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeColon BreakAfterJavaFieldAnnotations: false BreakStringLiterals: false ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false FixNamespaceComments: true ForEachMacros: - FOR_EACH - FOR_EACH_R - FOR_EACH_RANGE IncludeBlocks: Preserve IncludeCategories: - Regex: '^<.*\.h(pp)?>' Priority: 1 - Regex: '^<.*' Priority: 2 - Regex: '.*' Priority: 3 IndentCaseLabels: true IndentCaseBlocks: false IndentGotoLabels: true IndentPPDirectives: None IndentExternBlock: AfterExternBlock IndentWidth: 2 IndentWrappedFunctionNames: false InsertTrailingCommas: None JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: false MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: false PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left ReflowComments: true SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInConditionalStatement: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false SpaceBeforeSquareBrackets: false Standard: Latest TabWidth: 8 UseCRLF: false UseTab: Never ================================================ FILE: .clang-tidy ================================================ --- InheritParentConfig: true Checks: '> bugprone-argument-comment, bugprone-assert-side-effect, bugprone-bool-pointer-implicit-conversion, bugprone-copy-constructor-init, bugprone-dangling-handle, bugprone-exception-escape, bugprone-fold-init-type, bugprone-forward-declaration-namespace, bugprone-forwarding-reference-overload, bugprone-incorrect-enable-if, bugprone-inaccurate-erase, bugprone-incorrect-roundings, bugprone-infinite-loop, bugprone-integer-division, bugprone-macro-parentheses, bugprone-macro-repeated-side-effects, bugprone-misplaced-operator-in-strlen-in-alloc, bugprone-misplaced-widening-cast, bugprone-move-forwarding-reference, bugprone-multiple-statement-macro, bugprone-optional-value-conversion, bugprone-parent-virtual-call, bugprone-redundant-branch-condition, bugprone-shared-ptr-array-mismatch, bugprone-signed-char-misuse, bugprone-sizeof-container, bugprone-sizeof-expression, bugprone-string-constructor, bugprone-string-integer-assignment, bugprone-string-literal-with-embedded-nul, bugprone-suspicious-enum-usage, bugprone-suspicious-memset-usage, bugprone-suspicious-missing-comma, bugprone-suspicious-semicolon, bugprone-suspicious-string-compare, bugprone-swapped-arguments, bugprone-terminating-continue, bugprone-throw-keyword-missing, bugprone-too-small-loop-variable, bugprone-undefined-memory-manipulation, bugprone-undelegated-constructor, bugprone-unique-ptr-array-mismatch, bugprone-unsafe-functions, bugprone-unused-raii, bugprone-unused-return-value, bugprone-use-after-move, bugprone-virtual-near-miss, clang-analyzer-apiModeling.google.GTest, clang-analyzer-apiModeling.StdCLibraryFunctions, clang-analyzer-apiModeling.TrustNonnull, clang-analyzer-core.builtin.BuiltinFunctions, clang-analyzer-core.builtin.NoReturnFunctions, clang-analyzer-core.CallAndMessage, clang-analyzer-core.DivideZero, clang-analyzer-core.DynamicTypePropagation, clang-analyzer-core.NonnilStringConstants, clang-analyzer-core.NonNullParamChecker, clang-analyzer-core.NullDereference, clang-analyzer-core.StackAddressEscape, clang-analyzer-core.UndefinedBinaryOperatorResult, clang-analyzer-core.uninitialized.ArraySubscript, clang-analyzer-core.uninitialized.Assign, clang-analyzer-core.uninitialized.Branch, clang-analyzer-core.uninitialized.CapturedBlockVariable, clang-analyzer-core.uninitialized.UndefReturn, clang-analyzer-core.VLASize, clang-analyzer-cplusplus.InnerPointer, clang-analyzer-cplusplus.Move, clang-analyzer-cplusplus.NewDelete, clang-analyzer-cplusplus.NewDeleteLeaks, clang-analyzer-cplusplus.SelfAssignment, clang-analyzer-deadcode.DeadStores, clang-analyzer-nullability.NullableDereferenced, clang-analyzer-nullability.NullablePassedToNonnull, clang-analyzer-nullability.NullableReturnedFromNonnull, clang-analyzer-nullability.NullPassedToNonnull, clang-analyzer-nullability.NullReturnedFromNonnull, clang-analyzer-optin.cplusplus.VirtualCall, clang-analyzer-optin.mpi.MPI-Checker, clang-analyzer-optin.performance.GCDAntipattern, clang-analyzer-optin.performance.Padding, clang-analyzer-optin.portability.UnixAPI, clang-analyzer-security.FloatLoopCounter, clang-analyzer-security.insecureAPI.bcmp, clang-analyzer-security.insecureAPI.bcopy, clang-analyzer-security.insecureAPI.bzero, clang-analyzer-security.insecureAPI.getpw, clang-analyzer-security.insecureAPI.gets, clang-analyzer-security.insecureAPI.mkstemp, clang-analyzer-security.insecureAPI.mktemp, clang-analyzer-security.insecureAPI.rand, clang-analyzer-security.insecureAPI.strcpy, clang-analyzer-security.insecureAPI.UncheckedReturn, clang-analyzer-security.insecureAPI.vfork, clang-analyzer-unix.API, clang-analyzer-unix.cstring.BadSizeArg, clang-analyzer-unix.cstring.NullArg, clang-analyzer-unix.Malloc, clang-analyzer-unix.MallocSizeof, clang-analyzer-unix.MismatchedDeallocator, clang-analyzer-unix.Vfork, clang-analyzer-valist.CopyToSelf, clang-analyzer-valist.Uninitialized, clang-analyzer-valist.Unterminated, clang-diagnostic-*, cppcoreguidelines-avoid-const-or-ref-data-members, cppcoreguidelines-avoid-non-const-global-variables, cppcoreguidelines-init-variables, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-macro-usage, cppcoreguidelines-missing-std-forward, cppcoreguidelines-narrowing-conversions, cppcoreguidelines-no-malloc, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-type-cstyle-cast, cppcoreguidelines-pro-type-member-init, cppcoreguidelines-pro-type-reinterpret-cast, cppcoreguidelines-pro-type-union-access, cppcoreguidelines-pro-type-vararg, cppcoreguidelines-slicing, cppcoreguidelines-special-member-functions, facebook-hte-BadEnum, facebook-hte-MissingStatic, google-build-using-namespace, misc-definitions-in-headers, misc-header-include-cycle, misc-misplaced-const, misc-new-delete-overloads, misc-non-copyable-objects, misc-static-assert, misc-throw-by-value-catch-by-reference, misc-unconventional-assign-operator, misc-uniqueptr-reset-release, misc-unused-alias-decls, misc-unused-parameters, misc-unused-using-decls, modernize-avoid-bind, modernize-avoid-c-arrays, modernize-concat-nested-namespaces, modernize-deprecated-headers, modernize-deprecated-ios-base-aliases, modernize-loop-convert, modernize-make-shared, modernize-make-unique, modernize-pass-by-value, modernize-raw-string-literal, modernize-redundant-void-arg, modernize-replace-auto-ptr, modernize-replace-random-shuffle, modernize-return-braced-init-list, modernize-shrink-to-fit, modernize-unary-static-assert, modernize-use-auto, modernize-use-bool-literals, modernize-use-constraints, modernize-use-default-member-init, modernize-use-designated-initializers, modernize-use-emplace, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-noexcept, modernize-use-nullptr, modernize-use-override, modernize-use-starts-ends-with, modernize-use-transparent-functors, modernize-use-using, performance-faster-string-find, performance-for-range-copy, performance-implicit-conversion-in-loop, performance-inefficient-algorithm, performance-inefficient-string-concatenation, performance-inefficient-vector-operation, performance-move-const-arg, performance-move-constructor-init, performance-noexcept-move-constructor, performance-type-promotion-in-math-fn, performance-unnecessary-copy-initialization, performance-unnecessary-value-param, readability-avoid-const-params-in-decls, readability-braces-around-statements, readability-const-return-type, readability-container-size-empty, readability-delete-null-pointer, readability-deleted-default, readability-implicit-bool-conversion, readability-inconsistent-declaration-parameter-name, readability-isolate-declaration, readability-misplaced-array-index, readability-named-parameter, readability-non-const-parameter, readability-redundant-control-flow, readability-redundant-declaration, readability-redundant-function-ptr-dereference, readability-redundant-preprocessor, readability-redundant-smartptr-get, readability-redundant-string-cstr, readability-redundant-string-init, readability-simplify-boolean-expr, readability-simplify-subscript-expr, readability-static-accessed-through-instance, readability-static-definition-in-anonymous-namespace, readability-string-compare, readability-uniqueptr-delete-release, ' CheckOptions: - key: performance-unnecessary-value-param.AllowedTypes value: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$;' - key: performance-unnecessary-copy-initialization.AllowedTypes value: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$' ... ================================================ FILE: .editorconfig ================================================ root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false ================================================ FILE: .eslintrc.cjs ================================================ /** * 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. * * @format */ module.exports = { root: true, ignorePatterns: ['**/binaries/**', '**/build/**', '**/generated/**'], overrides: [ // Catch-all { files: ['**/*.?(m|c){j,t}s?(x)'], extends: ['eslint:recommended', 'plugin:prettier/recommended'], plugins: ['prettier'], rules: { 'no-unused-vars': ['error', {argsIgnorePattern: '^_'}], 'no-var': 'error', 'prefer-arrow-callback': 'error', 'prefer-const': 'error', 'prefer-object-spread': 'error', 'prefer-spread': 'error', 'require-await': 'error', }, env: { es2020: true, 'shared-node-browser': true, }, parserOptions: { ecmaVersion: 'latest', }, }, // ES Modules { files: ['**/*.?(m){j,t}s?(x)'], parserOptions: { sourceType: 'module', }, }, // CommonJS Modules { files: ['**/*.c{j,t}s?(x)'], env: { commonjs: true, }, parserOptions: { sourceType: 'commonjs', }, }, // TypeScript { files: ['**/*.?(m|c)ts?(x)'], extends: ['plugin:@typescript-eslint/recommended'], parser: '@typescript-eslint/parser', parserOptions: { project: true, }, plugins: ['@typescript-eslint'], rules: { '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-unused-vars': [ 'error', {argsIgnorePattern: '^_'}, ], '@typescript-eslint/no-var-requires': 'off', }, }, // Node { files: ['**/.*rc.(c){j,t}s', '**/*.config.?(c){j,t}s'], env: { node: true, }, }, // Jest { files: ['**/tests/**'], extends: ['plugin:jest/recommended'], }, ], }; ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ # Report - [ ] I have searched [existing issues](https://github.com/facebook/yoga/issues) and this is not a duplicate # Issues and Steps to Reproduce ***Replaces this with steps to repro your issue.*** # Expected Behavior ***Describe what you expected would happen.*** # Actual Behavior ***Describe what actually happened.*** # Link to Code ***If you have some code that maintainers can clone/test for themselves, bugs can be resolved much faster. Please paste a link here.*** ***When applicable, use this [fiddle](https://jsfiddle.net/emilsjolander/jckmwztt/) to post a web repro.*** ================================================ FILE: .github/actions/black/action.yml ================================================ name: Black Formatter inputs: directory: description: Directory to Lint required: true version: description: pypi version of "black" to use required: false default: 22.3.0 runs: using: "composite" steps: - name: Ensure supported Python selected uses: actions/setup-python@v4 with: python-version: '>=3.6.2' - name: pip install shell: bash run: pip install black==${{ inputs.version }} - name: black shell: bash run: black --check ${{ inputs.directory }} ================================================ FILE: .github/actions/cache-emsdk/action.yml ================================================ name: Cache the installed copy of emsdk and its build artifacts runs: using: "composite" steps: - name: Cache emsdk uses: actions/cache@v3 with: path: javascript/.emsdk key: emsdk-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock', 'javascript/package.json', 'javascript/just.config.cjs')}} ================================================ FILE: .github/actions/install-ninja/action.yml ================================================ name: Install Ninja runs: using: "composite" steps: - name: Install ninja (Linux) if: ${{ runner.os == 'Linux' }} shell: bash run: sudo apt-get install -y ninja-build - name: Install ninja (Windows) if: ${{ runner.os == 'Windows' }} shell: powershell run: choco install ninja ================================================ FILE: .github/actions/setup-android/action.yml ================================================ name: Setup Android environment runs: using: "composite" steps: - name: Select Java Version uses: actions/setup-java@v2 with: distribution: zulu java-version: 17 - name: Configure Gradle Caches uses: gradle/gradle-build-action@v2 ================================================ FILE: .github/actions/setup-apple/action.yml ================================================ name: Setup Apple envirionment runs: using: "composite" steps: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: 26.2 ================================================ FILE: .github/actions/setup-cpp/action.yml ================================================ name: Setup C++ envirionment inputs: toolchain: description: Compiler toolchain to use (Clang, GCC, or MSVC) required: false default: 'Clang' runs: using: "composite" steps: - name: Install Ninja if: ${{ runner.os != 'Windows' }} uses: ./.github/actions/install-ninja - name: Set Clang as compiler 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 echo "LDFLAGS=-stdlib=libc++" >> $GITHUB_ENV - name: Set GCC as compiler if: ${{ inputs.toolchain == 'GCC' }} shell: bash run: | echo "CC=/usr/bin/gcc" >> $GITHUB_ENV echo "CXX=/usr/bin/g++" >> $GITHUB_ENV - name: Setup VS Developer Command Prompt if: ${{ runner.os == 'Windows' }} uses: ilammy/msvc-dev-cmd@v1 ================================================ FILE: .github/actions/setup-js/action.yml ================================================ name: Setup JavaScript envirionment runs: using: "composite" steps: - name: Setup Node environment uses: actions/setup-node@v3 with: node-version: 20.x cache: yarn cache-dependency-path: yarn.lock env: # https://github.com/actions/setup-node/issues/317 FORCE_COLOR: 0 - name: yarn install shell: bash run: yarn install --frozen-lockfile ================================================ FILE: .github/workflows/publish-android-release.yml ================================================ name: Publish Android Release on: push: tags: - '*' workflow_dispatch: jobs: publish: name: Publish to Maven Central runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-android - name: Publish to Maven Local run: ./gradlew publishToMavenLocal env: ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }} ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: name: 'snapshot-artifacts' path: '~/.m2/repository/' - name: Publish to the Maven Central run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository env: ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }} ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} ================================================ FILE: .github/workflows/publish-android-snashot.yml ================================================ name: Publish Android Snapshot on: push: branches: - main workflow_dispatch: jobs: publish: name: Publish Snapshot runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-android - name: Publish to Maven Local run: ./gradlew publishToMavenLocal env: ORG_GRADLE_PROJECT_USE_SNAPSHOT: true - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: name: 'snapshot-artifacts' path: '~/.m2/repository/' - name: Publish to the Snapshot Repository run: ./gradlew publishToSonatype env: ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_USE_SNAPSHOT: true ================================================ FILE: .github/workflows/publish-npm-release.yml ================================================ name: Publish NPM Release on: push: tags: - '*' workflow_dispatch: jobs: publish: name: Publish to npmjs registry runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: Store auth token in config file run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: yarn publish run: yarn publish working-directory: javascript ================================================ FILE: .github/workflows/validate-android.yml ================================================ name: Validate Android on: pull_request: push: branches: - main - 'release-*' workflow_dispatch: jobs: build: name: Build [${{ matrix.os }}][${{ matrix.mode }}] runs-on: ${{ matrix.os }} strategy: matrix: mode: [Debug, Release] os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-android - name: Build run: ./gradlew assemble${{ matrix.mode }} --stacktrace ================================================ FILE: .github/workflows/validate-cpp.yml ================================================ name: Validate C++ on: pull_request: push: branches: - main - 'release-*' workflow_dispatch: env: GTEST_COLOR: 1 jobs: test: name: Build and Test [${{ matrix.toolchain }}][${{ matrix.mode }}] runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }} strategy: matrix: mode: [Debug, Release] toolchain: [Clang, GCC] # TODO: fix issues building GTest Binary with MSVC in GitHub Actions steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-cpp with: toolchain: ${{ matrix.toolchain }} - name: Unit tests run: ./unit_tests ${{ matrix.mode }} build_fuzzers: name: Build fuzzers [${{ matrix.toolchain }}][${{ matrix.mode }}] runs-on: ubuntu-latest strategy: matrix: mode: [Debug, Release] toolchain: [Clang] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-cpp with: toolchain: ${{ matrix.toolchain }} - name: Unit tests run: ./build_fuzz_tests ${{ matrix.mode }} benchmark: name: Benchmark [${{ matrix.toolchain }}] runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }} strategy: matrix: toolchain: [Clang, GCC, MSVC] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-cpp with: toolchain: ${{ matrix.toolchain }} - name: Build and run benchmark run: | cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release cmake --build build ./build/benchmark ./captures working-directory: benchmark - name: Build and run benchmarklegacy run: ./build/benchmarklegacy working-directory: benchmark capture: name: Capture [${{ matrix.toolchain }}] runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }} strategy: matrix: toolchain: [Clang, GCC, MSVC] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-cpp with: toolchain: ${{ matrix.toolchain }} - name: Build capture run: | cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release cmake --build build working-directory: capture ================================================ FILE: .github/workflows/validate-js.yml ================================================ name: Validate JavaScript on: pull_request: push: branches: - main - 'release-*' workflow_dispatch: env: FORCE_COLOR: 3 jobs: benchmark: name: Benchmark [${{ matrix.os }}] runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: Restore emsdk uses: ./.github/actions/cache-emsdk - name: yarn benchmark run: yarn benchmark working-directory: javascript build: name: Build [${{ matrix.os }}] runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: Restore emsdk uses: ./.github/actions/cache-emsdk - name: yarn build run: yarn build --verbose working-directory: javascript test: name: Test [${{ matrix.os }}] runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: Restore emsdk uses: ./.github/actions/cache-emsdk - name: yarn test run: yarn test working-directory: javascript lint: name: ESLint (All Packages) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: yarn lint run: yarn lint typecheck: name: Typecheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: yarn tsc run: yarn tsc working-directory: javascript pack: name: Pack runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: Restore emsdk uses: ./.github/actions/cache-emsdk - name: yarn pack run: yarn pack --filename yoga-layout.tar.gz working-directory: javascript - uses: actions/upload-artifact@v4 with: name: npm-package path: javascript/yoga-layout.tar.gz ================================================ FILE: .github/workflows/validate-swiftpm.yml ================================================ name: Validate SwiftPM on: pull_request: push: branches: - main - 'release-*' workflow_dispatch: jobs: test: name: Build runs-on: macos-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-apple - name: Build Debug run: swift build -c debug - name: Build Release run: swift build -c release ================================================ FILE: .github/workflows/validate-tests.yml ================================================ name: Validate Tests on: pull_request: push: branches: - main workflow_dispatch: jobs: validate: name: Validate runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup JS uses: ./.github/actions/setup-js - name: yarn gentest-validate run: yarn gentest-validate - name: yarn gentest run: yarn gentest -h - name: Check for modified tests run: | if [[ -n $(git status -s) ]]; then git status -s echo "yarn gentest modified these tests. Please run yarn gentest to resolve." exit 1 fi ================================================ FILE: .github/workflows/validate-website.yml ================================================ name: Validate Website on: pull_request: branches: - main push: branches: - main workflow_dispatch: jobs: build_next: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: Restore emsdk uses: ./.github/actions/cache-emsdk - name: Build Website run: yarn build working-directory: website typecheck: name: Typecheck [Docusaurus] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-js - name: yarn tsc run: yarn tsc working-directory: website ================================================ FILE: .gitignore ================================================ .DS_STORE /buck-cache/ /buck-out/ /.buckconfig.local /.buckd /gentest/test.html .buck-java11 node_modules # Jekyll /.sass-cache/ /_site/ # Visual studio code !.vscode *.pdb *.tlog *.obj *.pch *.log *.orig # Xcode ## Build generated build/ DerivedData/ ## Various settings *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata/ ## Other *.moved-aside *.xcuserstate ## Obj-C/Swift specific *.hmap *.ipa *.dSYM.zip *.dSYM # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # Pods/ # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # Gradle .gradle local.properties # NDK/CMake .cxx .externalNativeBuild # Docusarus build .docusaurus # Android Studio .idea ================================================ FILE: .prettierignore ================================================ **/binaries/** **/build/** **/generated/** ================================================ FILE: .prettierrc.js ================================================ /** * 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. * * @format */ module.exports = { arrowParens: 'avoid', bracketSameLine: true, bracketSpacing: false, singleQuote: true, trailingComma: 'all', }; ================================================ FILE: .vscode/extensions.json ================================================ { "recommendations": [ "ms-vscode.cpptools", "EditorConfig.EditorConfig", "dbaeumer.vscode-eslint", ] } ================================================ FILE: .vscode/launch.json ================================================ { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Debug C++ Unit tests (lldb)", "type": "cppdbg", "MIMode": "lldb", "request": "launch", "program": "${workspaceFolder}/tests/build/yogatests", "cwd": "${workspaceFolder}", "preLaunchTask": "Build Unit Tests" }, { "name": "Debug C++ Unit tests (vsdbg)", "type": "cppvsdbg", "request": "launch", "program": "${workspaceFolder}/tests/build/yogatests", "cwd": "${workspaceFolder}", "preLaunchTask": "Build Unit Tests" } ] } ================================================ FILE: .vscode/settings.json ================================================ { "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "eslint.format.enable": true, "eslint.packageManager": "yarn", "eslint.enable": true, "eslint.validate": [ "javascript", "javascriptreact", "typescript", "typescriptreact" ], "eslint.workingDirectories": [ { "mode": "auto" } ], } ================================================ FILE: .vscode/tasks.json ================================================ { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "Build Unit Tests", "type": "shell", "command": "(which ninja && cmake -B build -S . -D CMAKE_BUILD_TYPE=Debug -G Ninja || cmake -B build -S . -D CMAKE_BUILD_TYPE=Debug) && cmake --build build", "windows": { "command": "(where ninja && cmake -B build -S . -D CMAKE_BUILD_TYPE=Debug -G Ninja || cmake -B build -S . -D CMAKE_BUILD_TYPE=Debug) && cmake --build build", }, "group": "build", "options": { "cwd": "tests" }, "presentation": { "reveal": "always", "panel": "new" } } ] } ================================================ FILE: CMakeLists.txt ================================================ # 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. cmake_minimum_required(VERSION 3.13...3.26) project(yoga-all) set(CMAKE_VERBOSE_MAKEFILE on) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/project-defaults.cmake) add_subdirectory(yoga) add_subdirectory(tests) option(BUILD_FUZZ_TESTS "Build fuzz tests" OFF) if ('${CMAKE_CXX_COMPILER_ID}' MATCHES 'Clang' AND BUILD_FUZZ_TESTS) add_subdirectory(fuzz) endif() # cmake install config include(GNUInstallDirs) include(CMakePackageConfigHelpers) # declare target to install install(TARGETS yogacore EXPORT yoga-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) # install header files install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/yoga" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h" ) # install target config install(EXPORT yoga-targets FILE yogaTargets.cmake NAMESPACE yoga:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/yoga ) # generate config file configure_package_config_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/yoga-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/yogaConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/yoga ) # install config file install(FILES ${CMAKE_CURRENT_BINARY_DIR}/yogaConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/yoga ) ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing to yoga We want to make contributing to this project as easy and transparent as possible. ## Code of Conduct Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated. ## Pull Requests We actively welcome your pull requests. 1. Fork the repo and create your branch from `main`. 2. If you've added code that should be tested, add tests 3. If you've changed APIs, update the documentation. 4. Ensure the test suite passes. 5. Make sure your code lints. 6. If you haven't already, complete the Contributor License Agreement ("CLA"). ## Contributor License Agreement ("CLA") In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Facebook's open source projects. Complete your CLA here: ## Issues We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue. ## License By contributing to yoga, you agree that your contributions will be licensed under its MIT license. ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) Facebook, Inc. and its affiliates. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: LICENSE-examples ================================================ The examples provided by Facebook are for non-commercial testing and evaluation purposes only. Facebook reserves all rights not expressly granted. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Package.swift ================================================ // swift-tools-version:5.0 // The swift-tools-version declares the minimum version of Swift required to build this package. /* * 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. */ import PackageDescription let package = Package( name: "yoga", products: [ .library(name: "yoga", targets: [ "core" ]) ], targets: [ .target( name: "core", path: ".", sources: [ "yoga" ], publicHeadersPath: ".", cxxSettings: [ .headerSearchPath(".") ] ) ], cxxLanguageStandard: CXXLanguageStandard(rawValue: "c++20") ) ================================================ FILE: README.md ================================================ # Yoga [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![Maven Central](https://img.shields.io/maven-central/v/com.facebook.yoga/yoga)](https://search.maven.org/artifact/com.facebook.yoga/yoga) ![SPM](https://img.shields.io/badge/SPM-Supported-blue.svg) Yoga is an embeddable and performant flexbox layout engine with bindings for multiple languages. ## Building Yoga's main implementation targets C++ 20 with accompanying build logic in CMake. A wrapper is provided to build the main library and run unit tests. ```sh ./unit_tests ``` While not required, this script will use [ninja](https://ninja-build.org/) if it is installed for faster builds. Yoga is additionally part of the [vcpkg](https://github.com/Microsoft/vcpkg/) collection of ports maintained by Microsoft and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. ## Adding Tests Many of Yoga's tests are automatically generated, using HTML fixtures describing node structure. These are rendered in Chrome to generate an expected layout result for the tree. New fixtures can be added to `gentest/fixtures`. ```html
``` To generate new tests from added fixtures: 1. Ensure you have [yarn classic](https://classic.yarnpkg.com) installed. 2. Run `yarn install` to install dependencies for the test generator. 3. Run `yarn gentest` in the `yoga` directory. ## Debugging Yoga provides a VSCode "launch.json" configuration which allows debugging unit tests. Simply add your breakpoints, and run "Debug C++ Unit tests (lldb)" (or "Debug C++ Unit tests (vsdbg)" on Windows). ================================================ FILE: benchmark/Benchmark.cpp ================================================ /* * 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. */ #include #include #include #include #include #include #include #include #include namespace facebook::yoga { using namespace nlohmann; using namespace std::chrono; constexpr uint32_t kNumRepetitions = 100; using SteadyClockDurations = std::array; static bool inputsMatch( float actualWidth, float expectedWidth, float actualHeight, float expectedHeight, YGMeasureMode actualWidthMode, YGMeasureMode expectedWidthMode, YGMeasureMode actualHeightMode, YGMeasureMode expectedHeightMode) { bool widthsAreUndefined = YGFloatIsUndefined(actualWidth) && YGFloatIsUndefined(expectedWidth); bool widthsAreEqual = widthsAreUndefined || actualWidth == expectedWidth; bool heightsAreUndefined = YGFloatIsUndefined(actualHeight) && YGFloatIsUndefined(expectedHeight); bool heightsAreEqual = heightsAreUndefined || actualHeight == expectedHeight; return widthsAreEqual && heightsAreEqual && actualWidthMode == expectedWidthMode && actualHeightMode == expectedHeightMode; } YGSize defaultMeasureFunctionResult() { std::cout << "Trying to measure a node that wasn't serialized" << std::endl; return {10.0, 10.0}; } YGSize mockMeasureFunc( YGNodeConstRef node, float availableWidth, YGMeasureMode widthMode, float availableHeight, YGMeasureMode heightMode) { (void)node; auto fnsPtr = static_cast(YGNodeGetContext(node)); if (fnsPtr == nullptr) { return defaultMeasureFunctionResult(); } auto fnsIt = fnsPtr->find(node); if (fnsIt == fnsPtr->end()) { return defaultMeasureFunctionResult(); } for (auto measureFunc : fnsIt->second) { if (inputsMatch( availableWidth, measureFunc.inputWidth, availableHeight, measureFunc.inputHeight, widthMode, measureFunc.widthMode, heightMode, measureFunc.heightMode)) { std::this_thread::sleep_for( std::chrono::nanoseconds(measureFunc.durationNs)); return {measureFunc.outputWidth, measureFunc.outputHeight}; } } return defaultMeasureFunctionResult(); } std::shared_ptr buildConfigFromJson(const json& j) { json jsonConfig = j["config"]; std::shared_ptr config(YGConfigNew(), YGConfigFree); for (json::iterator it = jsonConfig.begin(); it != jsonConfig.end(); it++) { if (it.key() == "use-web-defaults") { YGConfigSetUseWebDefaults(config.get(), it.value()); } else if (it.key() == "point-scale-factor") { YGConfigSetPointScaleFactor(config.get(), it.value()); } else if (it.key() == "errata") { YGConfigSetErrata(config.get(), errataFromString(it.value())); } else if (it.key() == "experimental-features") { // Experimental features is serialized into an array where the values // present indicate that that feature is enabled for (json::iterator efIt = it.value().begin(); efIt != it.value().end(); efIt++) { YGConfigSetExperimentalFeatureEnabled( config.get(), experimentalFeatureFromString(efIt.value()), true); } } } return config; } std::string edgeStringFromPropertyName( const std::string& key, const std::string& propertyName) { return key.substr(propertyName.length() + 1); } void setStylesFromJson(const json& j, YGNodeRef node) { json style = j["style"]; for (const auto& [key, value] : style.items()) { if (key == "flex-direction") { YGNodeStyleSetFlexDirection(node, flexDirectionFromString(value)); } else if (key == "justify-content") { YGNodeStyleSetJustifyContent(node, justifyContentFromString(value)); } else if (key == "align-items") { YGNodeStyleSetAlignItems(node, alignFromString(value)); } else if (key == "align-content") { YGNodeStyleSetAlignContent(node, alignFromString(value)); } else if (key == "align-self") { YGNodeStyleSetAlignSelf(node, alignFromString(value)); } else if (key == "flex-wrap") { YGNodeStyleSetFlexWrap(node, wrapFromString(value)); } else if (key == "overflow") { YGNodeStyleSetOverflow(node, overflowFromString(value)); } else if (key == "display") { YGNodeStyleSetDisplay(node, displayFromString(value)); } else if (key == "position-type") { YGNodeStyleSetPositionType(node, positionTypeFromString(value)); } else if (key == "flex-grow") { YGNodeStyleSetFlexGrow(node, value); } else if (key == "flex-shrink") { YGNodeStyleSetFlexShrink(node, value); } else if (key == "flex") { YGNodeStyleSetFlex(node, value); } else if (key == "flex-basis") { YGUnit unit = unitFromJson(value); if (unit == YGUnitAuto) { YGNodeStyleSetFlexBasisAuto(node); } else if (unit == YGUnitPoint) { YGNodeStyleSetFlexBasis(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetFlexBasisPercent(node, value["value"]); } } else if (key.starts_with("position")) { YGEdge edge = edgeFromString(edgeStringFromPropertyName(key, "position")); YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetPosition(node, edge, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetPositionPercent(node, edge, value["value"]); } } else if (key.starts_with("padding")) { YGEdge edge = edgeFromString(edgeStringFromPropertyName(key, "padding")); YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetPadding(node, edge, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetPaddingPercent(node, edge, value["value"]); } } else if (key.starts_with("border")) { YGEdge edge = edgeFromString(edgeStringFromPropertyName(key, "border")); YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetBorder(node, edge, value["value"]); } } else if (key.starts_with("margin")) { YGEdge edge = edgeFromString(edgeStringFromPropertyName(key, "margin")); YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetMargin(node, edge, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetMarginPercent(node, edge, value["value"]); } else if (unit == YGUnitAuto) { YGNodeStyleSetMarginAuto(node, edge); } } else if (key == "gap") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetGap(node, YGGutterAll, value["value"]); } } else if (key == "column-gap") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetGap(node, YGGutterColumn, value["value"]); } } else if (key == "row-gap") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetGap(node, YGGutterRow, value["value"]); } } else if (key == "height") { YGUnit unit = unitFromJson(value); if (unit == YGUnitAuto) { YGNodeStyleSetHeightAuto(node); } else if (unit == YGUnitPoint) { YGNodeStyleSetHeight(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetHeightPercent(node, value["value"]); } } else if (key == "width") { YGUnit unit = unitFromJson(value); if (unit == YGUnitAuto) { YGNodeStyleSetWidthAuto(node); } else if (unit == YGUnitPoint) { YGNodeStyleSetWidth(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetWidthPercent(node, value["value"]); } } else if (key == "min-height") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetMinHeight(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetMinHeightPercent(node, value["value"]); } } else if (key == "min-width") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetMinWidth(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetMinWidthPercent(node, value["value"]); } } else if (key == "max-height") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetMaxHeight(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetMaxHeightPercent(node, value["value"]); } } else if (key == "max-width") { YGUnit unit = unitFromJson(value); if (unit == YGUnitPoint) { YGNodeStyleSetMaxWidth(node, value["value"]); } else if (unit == YGUnitPercent) { YGNodeStyleSetMaxWidthPercent(node, value["value"]); } } } } std::shared_ptr buildNodeFromJson( const json& j, std::shared_ptr config, std::shared_ptr fns) { std::shared_ptr node(YGNodeNewWithConfig(config.get()), YGNodeFree); if (!j.contains("node") || j["node"].is_null()) { return node; } json nodeState = j["node"]; for (json::iterator it = nodeState.begin(); it != nodeState.end(); it++) { if (it.key() == "always-forms-containing-block") { YGNodeSetAlwaysFormsContainingBlock(node.get(), it.value()); } else if (it.key() == "measure-funcs") { std::vector vec{}; for (auto measureFuncJson : it.value()) { vec.push_back(serializedMeasureFuncFromJson(measureFuncJson)); } fns->insert(std::make_pair(node.get(), vec)); YGNodeSetContext(node.get(), it.value().is_null() ? nullptr : fns.get()); YGNodeSetMeasureFunc(node.get(), mockMeasureFunc); } } return node; } std::shared_ptr buildTreeFromJson( const json& j, std::shared_ptr fns, std::shared_ptr parent, size_t index) { auto config = buildConfigFromJson(j); auto node = buildNodeFromJson(j, config, fns); auto wrapper = std::make_shared( node, config, std::vector>{}); if (parent != nullptr) { YGNodeInsertChild(parent->node_.get(), node.get(), index); parent->children_.push_back(wrapper); } setStylesFromJson(j, node.get()); if (j.contains("children")) { json children = j["children"]; size_t childIndex = 0; for (const json& child : children) { buildTreeFromJson(child, fns, wrapper, childIndex); childIndex++; } } return wrapper; } BenchmarkResult generateBenchmark(json& capture) { auto fns = std::make_shared(); auto treeCreationBegin = steady_clock::now(); std::shared_ptr root = buildTreeFromJson(capture["tree"], fns, nullptr, 0 /*index*/); auto treeCreationEnd = steady_clock::now(); json layoutInputs = capture["layout-inputs"]; float availableWidth = layoutInputs["available-width"]; float availableHeight = layoutInputs["available-height"]; YGDirection direction = directionFromString(layoutInputs["owner-direction"]); auto layoutBegin = steady_clock::now(); YGNodeCalculateLayout( root->node_.get(), availableWidth, availableHeight, direction); auto layoutEnd = steady_clock::now(); return BenchmarkResult{ treeCreationEnd - treeCreationBegin, layoutEnd - layoutBegin}; } static void printBenchmarkResult( const std::string& name, SteadyClockDurations& durations) { std::array timesInMs{}; double mean = 0; for (uint32_t i = 0; i < kNumRepetitions; i++) { auto ms = duration(durations[i]).count(); timesInMs[i] = ms; mean += ms; } mean /= kNumRepetitions; std::sort(timesInMs.begin(), timesInMs.end()); double median = timesInMs[kNumRepetitions / 2]; double variance = 0; for (uint32_t i = 0; i < kNumRepetitions; i++) { variance += std::pow(timesInMs[i] - mean, 2); } variance /= kNumRepetitions; double stddev = std::sqrt(variance); printf("%s: median: %lf ms, stddev: %lf ms\n", name.c_str(), median, stddev); } void benchmark(std::filesystem::path& capturesDir) { for (auto& capture : std::filesystem::directory_iterator(capturesDir)) { if (capture.is_directory() || capture.path().extension() != ".json") { continue; } SteadyClockDurations treeCreationDurations; SteadyClockDurations layoutDurations; SteadyClockDurations totalDurations; std::ifstream captureFile(capture.path()); json j = json::parse(captureFile); std::string captureName = capture.path().stem().string(); std::cout << "Starting benchmark for " << captureName << std::endl; for (uint32_t i = 0; i < kNumRepetitions; i++) { BenchmarkResult result = generateBenchmark(j); treeCreationDurations[i] = result.treeCreationDuration; layoutDurations[i] = result.layoutDuration; totalDurations[i] = result.treeCreationDuration + result.layoutDuration; } printBenchmarkResult(captureName + " tree creation", treeCreationDurations); printBenchmarkResult(captureName + " layout", layoutDurations); printBenchmarkResult(captureName + " total", totalDurations); std::cout << std::endl; } } } // namespace facebook::yoga int main(int argc, char* argv[]) { if (argc == 2) { std::filesystem::path capturesDir = argv[argc - 1]; facebook::yoga::benchmark(capturesDir); } else { throw std::invalid_argument("Expecting a path as an argument"); return 1; } return 0; } ================================================ FILE: benchmark/Benchmark.h ================================================ /* * 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. */ #pragma once #include #include #include #include #include #include namespace facebook::yoga { struct YogaNodeAndConfig { YogaNodeAndConfig( std::shared_ptr node, std::shared_ptr config, std::vector> children) : node_(std::move(node)), config_(std::move(config)), children_(std::move(children)) {} std::shared_ptr node_; std::shared_ptr config_; std::vector> children_; }; struct BenchmarkResult { std::chrono::steady_clock::duration treeCreationDuration; std::chrono::steady_clock::duration layoutDuration; }; } // namespace facebook::yoga ================================================ FILE: benchmark/CMakeLists.txt ================================================ # 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. cmake_minimum_required(VERSION 3.13...3.26) project(benchmark) set(CMAKE_VERBOSE_MAKEFILE on) set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) include(${YOGA_ROOT}/cmake/project-defaults.cmake) add_subdirectory(${YOGA_ROOT}/yoga ${CMAKE_CURRENT_BINARY_DIR}/yoga) file(GLOB SOURCES_LEGACY CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.c) file(GLOB SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(benchmark ${SOURCES}) add_executable(benchmarklegacy ${SOURCES_LEGACY}) target_link_libraries(benchmark yogacore) target_link_libraries(benchmarklegacy yogacore) target_include_directories(benchmark PRIVATE $) ================================================ FILE: benchmark/TreeDeserialization.cpp ================================================ /* * 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. */ #include #include #include #include #include #include namespace facebook::yoga { using namespace nlohmann; static inline bool isAuto(json& j) { return j.is_string() && j == "auto"; } static inline bool isUndefined(json& j) { return j.is_string() && j == "undefined"; } static inline std::string invalidArgumentMessage( const std::string& arg, const std::string& enumName) { return arg + " does not represent any " + enumName + " values"; } static inline float floatFromJson(json& j) { float result = YGUndefined; if (!j.is_null()) { result = j; } return result; } YGFlexDirection flexDirectionFromString(const std::string& str) { if (str == "row") { return YGFlexDirectionRow; } else if (str == "row-reverse") { return YGFlexDirectionRowReverse; } else if (str == "column") { return YGFlexDirectionColumn; } else if (str == "column-reverse") { return YGFlexDirectionColumnReverse; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGFlexDirection")); } } YGJustify justifyContentFromString(const std::string& str) { if (str == "flex-start") { return YGJustifyFlexStart; } else if (str == "center") { return YGJustifyCenter; } else if (str == "flex-end") { return YGJustifyFlexEnd; } else if (str == "space-between") { return YGJustifySpaceBetween; } else if (str == "space-around") { return YGJustifySpaceAround; } else if (str == "space-evenly") { return YGJustifySpaceEvenly; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGJustify")); } } YGAlign alignFromString(const std::string& str) { if (str == "auto") { return YGAlignAuto; } else if (str == "flex-start") { return YGAlignFlexStart; } else if (str == "center") { return YGAlignCenter; } else if (str == "flex-end") { return YGAlignFlexEnd; } else if (str == "stretch") { return YGAlignStretch; } else if (str == "baseline") { return YGAlignBaseline; } else if (str == "space-between") { return YGAlignSpaceBetween; } else if (str == "space-around") { return YGAlignSpaceAround; } else if (str == "space-evenly") { return YGAlignSpaceEvenly; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGAlign")); } } YGWrap wrapFromString(const std::string& str) { if (str == "no-wrap") { return YGWrapNoWrap; } else if (str == "wrap") { return YGWrapWrap; } else if (str == "wrap-reverse") { return YGWrapWrapReverse; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGAlign")); } } YGOverflow overflowFromString(const std::string& str) { if (str == "visible") { return YGOverflowVisible; } else if (str == "hidden") { return YGOverflowHidden; } else if (str == "scroll") { return YGOverflowScroll; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGAlign")); } } YGDisplay displayFromString(const std::string& str) { if (str == "flex") { return YGDisplayFlex; } else if (str == "none") { return YGDisplayNone; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGAlign")); } } YGPositionType positionTypeFromString(const std::string& str) { if (str == "static") { return YGPositionTypeStatic; } else if (str == "relative") { return YGPositionTypeRelative; } else if (str == "absolute") { return YGPositionTypeAbsolute; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGAlign")); } } YGUnit unitFromJson(json& j) { if (isAuto(j)) { return YGUnitAuto; } if (isUndefined(j)) { return YGUnitUndefined; } std::string unit = j["unit"]; if (unit == "px") { return YGUnitPoint; } else if (unit == "pct") { return YGUnitPercent; } else { throw std::invalid_argument(invalidArgumentMessage(unit, "YGUnit")); } } YGEdge edgeFromString(const std::string& str) { if (str == "left") { return YGEdgeLeft; } else if (str == "top") { return YGEdgeTop; } else if (str == "right") { return YGEdgeRight; } else if (str == "bottom") { return YGEdgeBottom; } else if (str == "start") { return YGEdgeStart; } else if (str == "end") { return YGEdgeEnd; } else if (str == "horizontal") { return YGEdgeHorizontal; } else if (str == "vertical") { return YGEdgeVertical; } else if (str == "all") { return YGEdgeAll; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGEdge")); } } YGErrata errataFromString(const std::string& str) { if (str == "none") { return YGErrataNone; } else if (str == "all") { return YGErrataAll; } else if (str == "classic") { return YGErrataClassic; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGErrata")); } } YGExperimentalFeature experimentalFeatureFromString(const std::string& str) { if (str == "web-flex-basis") { return YGExperimentalFeatureWebFlexBasis; } else { throw std::invalid_argument( invalidArgumentMessage(str, "YGExperimentalFeature")); } } std::string edgeStringFromPropertyName( const json::iterator& it, const std::string& propertyName) { return it.key().substr(propertyName.length() + 1); } YGDirection directionFromString(const std::string& str) { if (str == "ltr") { return YGDirectionLTR; } else if (str == "rtl") { return YGDirectionRTL; } else if (str == "inherit") { return YGDirectionInherit; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGDirection")); } } YGMeasureMode measureModeFromString(const std::string& str) { if (str == "at-most") { return YGMeasureModeAtMost; } else if (str == "exactly") { return YGMeasureModeExactly; } else if (str == "undefined") { return YGMeasureModeUndefined; } else { throw std::invalid_argument(invalidArgumentMessage(str, "YGMeasureMode")); } } SerializedMeasureFunc serializedMeasureFuncFromJson(json& j) { return SerializedMeasureFunc{ .inputWidth = floatFromJson(j["width"]), .widthMode = measureModeFromString(j["width-mode"]), .inputHeight = floatFromJson(j["height"]), .heightMode = measureModeFromString(j["height-mode"]), .outputWidth = floatFromJson(j["output-width"]), .outputHeight = floatFromJson(j["output-height"]), .durationNs = j["duration-ns"]}; } } // namespace facebook::yoga ================================================ FILE: benchmark/TreeDeserialization.h ================================================ /* * 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. */ #pragma once #include #include #include #include #include namespace facebook::yoga { using namespace nlohmann; YGFlexDirection flexDirectionFromString(const std::string& str); YGJustify justifyContentFromString(const std::string& str); YGAlign alignFromString(const std::string& str); YGWrap wrapFromString(const std::string& str); YGOverflow overflowFromString(const std::string& str); YGDisplay displayFromString(const std::string& str); YGPositionType positionTypeFromString(const std::string& str); YGUnit unitFromJson(json& j); YGEdge edgeFromString(const std::string& str); YGErrata errataFromString(const std::string& str); YGExperimentalFeature experimentalFeatureFromString(const std::string& str); std::string edgeStringFromPropertyName( const json::iterator& it, const std::string& propertyName); YGDirection directionFromString(const std::string& str); YGMeasureMode measureModeFromString(const std::string& str); SerializedMeasureFunc serializedMeasureFuncFromJson(json& j); } // namespace facebook::yoga ================================================ FILE: benchmark/YGBenchmark.c ================================================ /* * 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. */ #include #include #include #include #include #include #define NUM_REPETITIONS 1000 #define YGBENCHMARKS(BLOCK) \ int main(int argc, char const* argv[]) { \ (void)argc; \ (void)argv; \ clock_t __start; \ clock_t __endTimes[NUM_REPETITIONS]; \ { \ BLOCK \ } \ return 0; \ } #define YGBENCHMARK(NAME, BLOCK) \ __start = clock(); \ for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \ {BLOCK} __endTimes[__i] = clock(); \ } \ __printBenchmarkResult(NAME, __start, __endTimes); static int __compareDoubles(const void* a, const void* b) { double arg1 = *(const double*)a; double arg2 = *(const double*)b; if (arg1 < arg2) { return -1; } if (arg1 > arg2) { return 1; } return 0; } static void __printBenchmarkResult(char* name, clock_t start, const clock_t* endTimes) { double timesInMs[NUM_REPETITIONS]; double mean = 0; clock_t lastEnd = start; for (uint32_t i = 0; i < NUM_REPETITIONS; i++) { timesInMs[i] = ((double)(endTimes[i] - lastEnd)) / (double)CLOCKS_PER_SEC * 1000; lastEnd = endTimes[i]; mean += timesInMs[i]; } mean /= NUM_REPETITIONS; qsort(timesInMs, NUM_REPETITIONS, sizeof(double), __compareDoubles); double median = timesInMs[NUM_REPETITIONS / 2]; double variance = 0; for (uint32_t i = 0; i < NUM_REPETITIONS; i++) { variance += pow(timesInMs[i] - mean, 2); } variance /= NUM_REPETITIONS; double stddev = sqrt(variance); printf("%s: median: %lf ms, stddev: %lf ms\n", name, median, stddev); } static YGSize _measure( YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) { (void)node; return (YGSize){ .width = widthMode == YGMeasureModeUndefined ? 10 : width, .height = heightMode == YGMeasureModeUndefined ? 10 : height, }; } YGBENCHMARKS({ YGBENCHMARK("Stack with flex", { const YGNodeRef root = YGNodeNew(); YGNodeStyleSetWidth(root, 100); YGNodeStyleSetHeight(root, 100); for (uint32_t i = 0; i < 10; i++) { const YGNodeRef child = YGNodeNew(); YGNodeSetMeasureFunc(child, _measure); YGNodeStyleSetFlex(child, 1); YGNodeInsertChild(root, child, 0); } YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeFreeRecursive(root); }); YGBENCHMARK("Align stretch in undefined axis", { const YGNodeRef root = YGNodeNew(); for (uint32_t i = 0; i < 10; i++) { const YGNodeRef child = YGNodeNew(); YGNodeStyleSetHeight(child, 20); YGNodeSetMeasureFunc(child, _measure); YGNodeInsertChild(root, child, 0); } YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeFreeRecursive(root); }); YGBENCHMARK("Nested flex", { const YGNodeRef root = YGNodeNew(); for (uint32_t i = 0; i < 10; i++) { const YGNodeRef child = YGNodeNew(); YGNodeStyleSetFlex(child, 1); YGNodeInsertChild(root, child, 0); for (uint32_t ii = 0; ii < 10; ii++) { const YGNodeRef grandChild = YGNodeNew(); YGNodeSetMeasureFunc(grandChild, _measure); YGNodeStyleSetFlex(grandChild, 1); YGNodeInsertChild(child, grandChild, 0); } } YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeFreeRecursive(root); }); YGBENCHMARK("Huge nested layout", { const YGNodeRef root = YGNodeNew(); for (uint32_t i = 0; i < 10; i++) { const YGNodeRef child = YGNodeNew(); YGNodeStyleSetFlexGrow(child, 1); YGNodeStyleSetWidth(child, 10); YGNodeStyleSetHeight(child, 10); YGNodeInsertChild(root, child, 0); for (uint32_t ii = 0; ii < 10; ii++) { const YGNodeRef grandChild = YGNodeNew(); YGNodeStyleSetFlexDirection(grandChild, YGFlexDirectionRow); YGNodeStyleSetFlexGrow(grandChild, 1); YGNodeStyleSetWidth(grandChild, 10); YGNodeStyleSetHeight(grandChild, 10); YGNodeInsertChild(child, grandChild, 0); for (uint32_t iii = 0; iii < 10; iii++) { const YGNodeRef grandGrandChild = YGNodeNew(); YGNodeStyleSetFlexGrow(grandGrandChild, 1); YGNodeStyleSetWidth(grandGrandChild, 10); YGNodeStyleSetHeight(grandGrandChild, 10); YGNodeInsertChild(grandChild, grandGrandChild, 0); for (uint32_t iiii = 0; iiii < 10; iiii++) { const YGNodeRef grandGrandGrandChild = YGNodeNew(); YGNodeStyleSetFlexDirection( grandGrandGrandChild, YGFlexDirectionRow); YGNodeStyleSetFlexGrow(grandGrandGrandChild, 1); YGNodeStyleSetWidth(grandGrandGrandChild, 10); YGNodeStyleSetHeight(grandGrandGrandChild, 10); YGNodeInsertChild(grandGrandChild, grandGrandGrandChild, 0); } } } } YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeFreeRecursive(root); }); }); ================================================ FILE: benchmark/benchmark ================================================ #!/bin/sh # 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. cd "$(dirname "$0")" || exit CAPTURES_PATH="$(dirname "$(realpath "$0")")""/captures" if [ "$1" = "buck" ]; then buck run @//fbcode/mode/opt :benchmarkCXX "${CAPTURES_PATH}" else cmake -B build -S . -D CMAKE_BUILD_TYPE=Release cmake --build build build/benchmark "${CAPTURES_PATH}" fi ================================================ FILE: benchmark/captures/chat-mac.json ================================================ { "layout-inputs": { "available-height": 768.0, "available-width": 1024.0, "owner-direction": "ltr" }, "tree": { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "config": { "errata": "all" }, "style": { "flex": 1.0, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "height": { "unit": "px", "value": 28.0 }, "margin-all": { "unit": "px", "value": 6.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "height": { "unit": "px", "value": 28.0 }, "margin-all": { "unit": "px", "value": 6.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "height": { "unit": "px", "value": 28.0 }, "margin-all": { "unit": "px", "value": 6.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "height": { "unit": "px", "value": 28.0 }, "margin-all": { "unit": "px", "value": 6.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "height": { "unit": "px", "value": 32.0 }, "margin-bottom": { "unit": "px", "value": 13.0 }, "margin-end": { "unit": "px", "value": 13.0 }, "margin-start": { "unit": "px", "value": 14.0 }, "margin-top": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-content": "center", "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-content": "stretch", "flex": 1.0, "margin-top": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "overflow": "hidden", "width": { "unit": "px", "value": 70.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "px", "value": 1.0 } } } ], "config": { "errata": "all" }, "style": { "margin-horizontal": { "unit": "px", "value": -1.0 }, "min-width": { "unit": "px", "value": 10.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 70.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 28125, "height": 732.0, "height-mode": "at-most", "output-height": 23.0, "output-width": 55.5, "width": 294.0, "width-mode": "at-most" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -2.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "flex-start", "flex-shrink": 1.0, "margin-left": { "unit": "px", "value": 16.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "flex-direction": "row", "margin-right": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "space-between", "padding-bottom": { "unit": "px", "value": 8.0 }, "padding-top": { "unit": "px", "value": 30.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 16.0 }, "margin-start": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": -8.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "position-left": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8625, "height": 659.0, "height-mode": "at-most", "output-height": 16.0, "output-width": 236.0, "width": 236.0, "width-mode": "exactly" } ] }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "flex": 1.0, "margin-all": { "unit": "px", "value": 0.0 }, "margin-end": { "unit": "px", "value": 0.0 }, "min-height": { "unit": "px", "value": 32.0 }, "padding-bottom": { "unit": "px", "value": 10.0 }, "padding-end": { "unit": "px", "value": 24.0 }, "padding-horizontal": { "unit": "px", "value": 10.0 }, "padding-start": { "unit": "px", "value": 24.0 }, "padding-top": { "unit": "px", "value": 10.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 14.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 16.0 }, "justify-content": "center", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 16.0 }, "justify-content": "center", "padding-all": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "display": "none" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "position-right": { "unit": "px", "value": 8.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 1.0 }, "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 6.0 }, "margin-horizontal": { "unit": "px", "value": 12.0 }, "margin-top": { "unit": "px", "value": 7.0 }, "min-width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": null }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 1.0 }, "margin-horizontal": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8458, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 30.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 10917, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 36.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8166, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 32.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6250, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 50.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7750, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 28.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6708, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 49.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6625, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 32.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6083, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 28.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6542, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 33.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6083, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 33.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6833, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 45.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6166, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 29.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7666, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 34.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6000, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 14.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6834, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 25.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5959, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 50.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6500, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 47.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 12625, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 48.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7333, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 24.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5875, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 45.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7375, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 39.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6792, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 46.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6542, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 33.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6333, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 33.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6500, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 47.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5833, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 48.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6583, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 29.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5875, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 50.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6792, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 46.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6167, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 39.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6625, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 27.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5916, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 43.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6250, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 31.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5792, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 39.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 39.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6458, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 36.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6291, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 40.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5750, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6291, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 20.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6292, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 23.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6334, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 32.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6250, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 42.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6709, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 18.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6542, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 49.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6458, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 42.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 30.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 34.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6166, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 42.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6750, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 38.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5709, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 46.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 26.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5833, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 28.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6334, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 27.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5958, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 49.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6333, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 49.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5917, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 38.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8500, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 31.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5875, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 30.0, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "justify-content": "flex-end", "margin-bottom": { "unit": "px", "value": 8.0 }, "position-type": "relative" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 41.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6292, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 37.5, "width": 50.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 14.0 }, "margin-right": { "unit": "px", "value": 12.0 }, "padding-horizontal": { "unit": "px", "value": 5.0 }, "width": { "unit": "px", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 18.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 18.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 24.0 }, "justify-content": "center", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 24.0 }, "justify-content": "center", "padding-all": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "position-top": { "unit": "px", "value": 13.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "pct", "value": 100.0 }, "justify-content": "center", "position-right": { "unit": "px", "value": 16.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 20.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "padding-top": { "unit": "px", "value": 11.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 18.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 32.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "margin-end": { "unit": "px", "value": 8.0 }, "margin-top": { "unit": "px", "value": 1.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7375, "height": null, "height-mode": "undefined", "output-height": 36.0, "output-width": 152.0, "width": 200.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-shrink": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-end": { "unit": "px", "value": 20.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7166, "height": null, "height-mode": "undefined", "output-height": 32.0, "output-width": 220.0, "width": 220.0, "width-mode": "exactly" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "padding-top": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 12292, "height": 31.0, "height-mode": "at-most", "output-height": 18.0, "output-width": 64.0, "width": 240.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": 1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 2.0 }, "min-width": { "unit": "px", "value": 52.0 }, "padding-end": { "unit": "px", "value": 8.0 }, "padding-start": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-top": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 14.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 16.0 }, "justify-content": "center", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 16.0 }, "justify-content": "center", "padding-all": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "position-right": { "unit": "px", "value": 12.0 }, "position-top": { "unit": "px", "value": 12.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "margin-bottom": { "unit": "px", "value": 8.0 }, "padding-all": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-top": { "unit": "px", "value": 6.0 } } }, { "config": { "errata": "all" }, "style": { "margin-top": { "unit": "px", "value": 1.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6625, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 87.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6625, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 133.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 9084, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 38.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6459, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 98.5, "width": 188.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6083, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 78.5, "width": 188.0, "width-mode": "at-most" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8917, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 78.0, "width": 188.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-direction": "row-reverse" } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6333, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 102.0, "width": 186.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6083, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 78.5, "width": 186.0, "width-mode": "at-most" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8292, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 78.0, "width": 186.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 14.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 66.5, "width": 186.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6292, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 96.5, "width": 186.0, "width-mode": "at-most" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8292, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 79.5, "width": 186.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 14.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6833, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 74.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5834, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 116.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8125, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 81.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6708, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 101.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6625, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 207.5, "width": 208.0, "width-mode": "at-most" }, { "duration-ns": 4791, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 128.5, "width": 128.5, "width-mode": "exactly" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8417, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 79.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 34.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 34.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 34.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 34.0 } } } ], "config": { "errata": "all" }, "style": { "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 50.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6500, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 99.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5917, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 141.0, "width": 208.0, "width-mode": "at-most" }, { "duration-ns": 4834, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 128.5, "width": 128.5, "width-mode": "exactly" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8291, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 79.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 50.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6542, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 83.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 5792, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 37.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8250, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 80.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 34.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 34.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 34.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 34.0 } } } ], "config": { "errata": "all" }, "style": { "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 12.0 }, "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 2.0 }, "position-left": { "unit": "px", "value": 36.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 50.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6458, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 82.0, "width": 208.0, "width-mode": "at-most" } ] }, "style": { "align-self": "flex-start", "margin-bottom": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6541, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 204.5, "width": 208.0, "width-mode": "at-most" }, { "duration-ns": 4542, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 127.5, "width": 127.5, "width-mode": "exactly" } ] }, "style": { "flex-shrink": 1.0 } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8333, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 80.5, "width": 208.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 8.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "px", "value": 310.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "px", "value": 1.0 } } } ], "config": { "errata": "all" }, "style": { "margin-horizontal": { "unit": "px", "value": -1.0 }, "min-width": { "unit": "px", "value": 10.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 380.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6584, "height": 768.0, "height-mode": "at-most", "output-height": 20.0, "output-width": 119.0, "width": 644.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "height": { "unit": "pct", "value": 100.0 }, "justify-content": "center", "position-left": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6750, "height": 20.0, "height-mode": "at-most", "output-height": 18.0, "output-width": 423.0, "width": 423.0, "width-mode": "exactly" } ] }, "style": { "max-height": { "unit": "px", "value": 20.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6500, "height": 47.0, "height-mode": "at-most", "output-height": 16.0, "output-width": 423.0, "width": 423.0, "width-mode": "exactly" } ] }, "style": { "margin-top": { "unit": "px", "value": 1.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-horizontal": { "unit": "px", "value": 10.0 }, "margin-vertical": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row", "padding-bottom": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "margin-left": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "align-content": "flex-end", "flex": 1.0, "flex-direction": "row", "height": { "unit": "px", "value": 48.0 }, "margin-top": { "unit": "px", "value": -5.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row", "margin-start": { "unit": "px", "value": 5.0 }, "padding-top": { "unit": "px", "value": 26.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 1.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "min-height": { "unit": "px", "value": 74.0 }, "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-top": { "unit": "px", "value": 4.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 39.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "margin-right": { "unit": "px", "value": 2.0 }, "padding-bottom": { "unit": "px", "value": 3.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7167, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 107.5, "width": 605.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8167, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 239.0, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-bottom": { "unit": "px", "value": -19.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-bottom": { "unit": "px", "value": 24.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-left": { "unit": "px", "value": 12.0 }, "padding-right": { "unit": "px", "value": 12.0 }, "padding-top": { "unit": "px", "value": 6.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7042, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 110.0, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 11958, "height": 15.0, "height-mode": "at-most", "output-height": 15.0, "output-width": 13.0, "width": 14.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": -1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 14.0 }, "justify-content": "center", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "margin-end": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -5.0 }, "padding-horizontal": { "unit": "px", "value": 4.0 }, "padding-vertical": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "flex-end" } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } }, { "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8291, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 77.0, "width": 629.0, "width-mode": "at-most" } ] }, "style": { "flex-wrap": "wrap" } } ], "config": { "errata": "all" }, "style": { "align-self": "stretch", "flex-direction": "row", "justify-content": "center", "padding-all": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 21.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7667, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 4791, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7084, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 266.5, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "max-height": { "unit": "pct", "value": 100.0 }, "max-width": { "unit": "pct", "value": 100.0 }, "overflow": "hidden", "padding-all": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 23.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7208, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 5833, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 33.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 33.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 0.0 }, "width": { "unit": "pct", "value": 33.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 33.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 33.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 0.0 }, "width": { "unit": "pct", "value": 33.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 33.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 33.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 0.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex-wrap": "wrap", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 3.0 }, "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "max-height": { "unit": "pct", "value": 100.0 }, "max-width": { "unit": "pct", "value": 100.0 }, "overflow": "hidden", "padding-all": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7250, "height": 15.0, "height-mode": "at-most", "output-height": 15.0, "output-width": 13.0, "width": 14.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": -1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 14.0 }, "justify-content": "center", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "margin-end": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -5.0 }, "padding-horizontal": { "unit": "px", "value": 4.0 }, "padding-vertical": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "flex-end" } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "padding-bottom": { "unit": "px", "value": 4.0 }, "position-bottom": { "unit": "px", "value": 15.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 10833, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 82.5, "width": 629.0, "width-mode": "at-most" } ] }, "style": { "flex-wrap": "wrap" } } ], "config": { "errata": "all" }, "style": { "align-self": "stretch", "flex-direction": "row", "justify-content": "center", "padding-all": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 39.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6791, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 4917, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 9167, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 273.0, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7334, "height": 15.0, "height-mode": "at-most", "output-height": 15.0, "output-width": 13.0, "width": 14.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": -1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 14.0 }, "justify-content": "center", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "margin-end": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -5.0 }, "padding-horizontal": { "unit": "px", "value": 4.0 }, "padding-vertical": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "flex-end" } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 23.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6792, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 48.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 5000, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7208, "height": null, "height-mode": "undefined", "output-height": 36.0, "output-width": 319.5, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7583, "height": 15.0, "height-mode": "at-most", "output-height": 15.0, "output-width": 13.0, "width": 14.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": -1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 14.0 }, "justify-content": "center", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "margin-end": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -5.0 }, "padding-horizontal": { "unit": "px", "value": 4.0 }, "padding-vertical": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "flex-end" } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all" }, "style": { "margin-right": { "unit": "px", "value": 2.0 }, "padding-bottom": { "unit": "px", "value": 3.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 11291, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 130.0, "width": 605.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8000, "height": null, "height-mode": "undefined", "output-height": 32.0, "output-width": 345.0, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 4542, "height": null, "height-mode": "undefined", "output-height": 32.0, "output-width": 319.5, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-bottom": { "unit": "px", "value": -19.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-bottom": { "unit": "px", "value": 24.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-left": { "unit": "px", "value": 12.0 }, "padding-right": { "unit": "px", "value": 12.0 }, "padding-top": { "unit": "px", "value": 6.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6542, "height": null, "height-mode": "undefined", "output-height": 54.0, "output-width": 331.5, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 4417, "height": null, "height-mode": "undefined", "output-height": 54.0, "output-width": 321.0, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7083, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 74.5, "width": 629.0, "width-mode": "at-most" } ] }, "style": { "flex-wrap": "wrap" } } ], "config": { "errata": "all" }, "style": { "align-self": "stretch", "flex-direction": "row", "justify-content": "center", "padding-all": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6458, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 3959, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 3.0 }, "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 1.0 }, "flex": 1.0, "height": { "unit": "px", "value": 200.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-end": { "unit": "px", "value": 0.0 }, "width": { "unit": "pct", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 0.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex-wrap": "wrap", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-bottom": { "unit": "px", "value": 3.0 }, "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 16667, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 105.0, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "max-height": { "unit": "pct", "value": 100.0 }, "max-width": { "unit": "pct", "value": 100.0 }, "overflow": "hidden", "padding-all": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7542, "height": null, "height-mode": "undefined", "output-height": 54.0, "output-width": 345.0, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 4792, "height": null, "height-mode": "undefined", "output-height": 54.0, "output-width": 321.0, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6500, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 4042, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 12875, "height": null, "height-mode": "undefined", "output-height": 54.0, "output-width": 338.5, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 5458, "height": null, "height-mode": "undefined", "output-height": 72.0, "output-width": 305.5, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6958, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 74.5, "width": 629.0, "width-mode": "at-most" } ] }, "style": { "flex-wrap": "wrap" } } ], "config": { "errata": "all" }, "style": { "align-self": "stretch", "flex-direction": "row", "justify-content": "center", "padding-all": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 39.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6292, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 22.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 6208, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6958, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 292.5, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 14125, "height": 15.0, "height-mode": "at-most", "output-height": 15.0, "output-width": 13.0, "width": 14.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": -1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 14.0 }, "justify-content": "center", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "margin-end": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -5.0 }, "padding-horizontal": { "unit": "px", "value": 4.0 }, "padding-vertical": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "flex-end" } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 12.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "flex-direction": "row", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 15417, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 70.0, "width": 629.0, "width-mode": "at-most" } ] }, "style": { "flex-wrap": "wrap" } } ], "config": { "errata": "all" }, "style": { "align-self": "stretch", "flex-direction": "row", "justify-content": "center", "padding-all": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6833, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 4083, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8250, "height": null, "height-mode": "undefined", "output-height": 90.0, "output-width": 345.0, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 4708, "height": null, "height-mode": "undefined", "output-height": 90.0, "output-width": 318.0, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 12708, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 3958, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7208, "height": null, "height-mode": "undefined", "output-height": 36.0, "output-width": 334.0, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 4500, "height": null, "height-mode": "undefined", "output-height": 54.0, "output-width": 278.5, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 23.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6292, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 48.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 4041, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 10667, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 332.0, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 4416, "height": null, "height-mode": "undefined", "output-height": 36.0, "output-width": 316.0, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6834, "height": 15.0, "height-mode": "at-most", "output-height": 15.0, "output-width": 13.0, "width": 14.0, "width-mode": "at-most" } ] }, "style": { "margin-top": { "unit": "px", "value": -1.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 14.0 }, "justify-content": "center", "width": { "unit": "px", "value": 14.0 } } } ], "config": { "errata": "all" }, "style": { "margin-start": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "margin-end": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -5.0 }, "padding-horizontal": { "unit": "px", "value": 4.0 }, "padding-vertical": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "flex-end" } } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6458, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 21.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 3917, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7500, "height": null, "height-mode": "undefined", "output-height": 126.0, "output-width": 345.0, "width": 345.0, "width-mode": "at-most" }, { "duration-ns": 5000, "height": null, "height-mode": "undefined", "output-height": 126.0, "output-width": 319.5, "width": 321.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 28.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-end", "margin-bottom": { "unit": "px", "value": 1.0 }, "padding-end": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "margin-end": "auto", "margin-start": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6666, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 48.0, "width": 603.0, "width-mode": "at-most" }, { "duration-ns": 4583, "height": null, "height-mode": "undefined", "output-height": 14.0, "output-width": 563.0, "width": 563.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-start": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6958, "height": null, "height-mode": "undefined", "output-height": 18.0, "output-width": 229.5, "width": 345.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "center" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "overflow": "hidden", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-height": { "unit": "px", "value": 280.0 }, "overflow": "hidden", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "margin-end": "auto", "margin-vertical": { "unit": "px", "value": 1.0 }, "max-height": { "unit": "pct", "value": 100.0 }, "max-width": { "unit": "pct", "value": 100.0 }, "overflow": "hidden", "padding-all": { "unit": "px", "value": 0.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 4.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "position-left": { "unit": "pct", "value": 100.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "align-self": "flex-start", "min-width": { "unit": "px", "value": 1.0 }, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "max-width": { "unit": "pct", "value": 60.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 0.0, "flex-direction": "row", "padding-right": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 12.0 }, "padding-vertical": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 24.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "justify-content": "center", "padding-all": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 6.0 }, "margin-top": { "unit": "px", "value": 40.0 } } } ], "config": { "errata": "all" }, "style": { "padding-top": { "unit": "px", "value": 46.0 } } } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "flex-shrink": 1.0, "height": { "unit": "pct", "value": 100.0 }, "margin-top": { "unit": "px", "value": 0.0 }, "overflow": "scroll" } } ], "config": { "errata": "all" }, "style": null }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 0.0 }, "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "width": { "unit": "px", "value": 36.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "position-bottom": { "unit": "px", "value": 15.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "margin-start": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "margin-start": { "unit": "px", "value": 17.0 }, "padding-end": { "unit": "px", "value": 17.0 }, "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "flex-direction": "row", "margin-start": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6000, "height": 189.0, "height-mode": "at-most", "output-height": 18.0, "output-width": 442.0, "width": 442.0, "width-mode": "exactly" } ] }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "max-height": { "unit": "px", "value": 200.0 }, "padding-horizontal": { "unit": "px", "value": 10.0 }, "padding-top": { "unit": "px", "value": 5.0 }, "padding-vertical": { "unit": "px", "value": 6.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "padding-start": { "unit": "px", "value": 1.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "margin-end": { "unit": "px", "value": 1.0 }, "margin-start": { "unit": "px", "value": 3.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center" } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "align-self": "flex-end", "flex-direction": "row", "margin-start": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "flex-direction": "row", "margin-vertical": { "unit": "px", "value": 2.0 } } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 0.0 }, "flex": 1.0, "margin-end": { "unit": "px", "value": 10.0 }, "min-height": { "unit": "px", "value": 32.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7916, "height": 32.0, "height-mode": "at-most", "output-height": 25.0, "output-width": 20.0, "width": 30.5, "width-mode": "at-most" } ] }, "style": { "padding-left": { "unit": "px", "value": 1.5 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 32.0 }, "justify-content": "center", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 32.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "margin-left": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "flex-end", "flex-direction": "row", "padding-end": { "unit": "px", "value": 10.0 }, "padding-vertical": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 22.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 22.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "justify-content": "center" } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 28.0 }, "position-top": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 28.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "justify-content": "center", "position-end": { "unit": "px", "value": 40.0 }, "position-top": { "unit": "px", "value": 5.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex-grow": 1.0, "position-type": "relative" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7125, "height": null, "height-mode": "undefined", "output-height": 7.0, "output-width": 70.5, "width": 1020.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "justify-content": "center", "padding-all": { "unit": "px", "value": 2.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 2.0 }, "style": { "max-height": { "unit": "px", "value": 768.0 }, "max-width": { "unit": "px", "value": 1024.0 }, "min-height": { "unit": "px", "value": 768.0 }, "min-width": { "unit": "px", "value": 1024.0 } } } } ================================================ FILE: benchmark/captures/feed-android.json ================================================ { "layout-inputs": { "available-height": 604.3333129882813, "available-width": 360.0, "owner-direction": "ltr" }, "tree": { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 30104, "height": 586.0, "height-mode": "at-most", "output-height": 17.66666603088379, "output-width": 24.33333396911621, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "margin-left": { "unit": "px", "value": -12.0 }, "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 29.0 }, "width": { "unit": "px", "value": 1.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 8385, "height": 586.0, "height-mode": "at-most", "output-height": 17.66666603088379, "output-width": 50.33333206176758, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "margin-end": { "unit": "px", "value": 4.0 }, "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "flex-start", "justify-content": "center" } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7136, "height": 586.0, "height-mode": "at-most", "output-height": 17.66666603088379, "output-width": 36.33333206176758, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "flex-start", "justify-content": "center" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "padding-left": { "unit": "px", "value": 16.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 8073, "height": 586.0, "height-mode": "at-most", "output-height": 17.66666603088379, "output-width": 35.0, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 }, "padding-vertical": { "unit": "px", "value": 8.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-start": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "padding-bottom": { "unit": "px", "value": 8.0 }, "padding-left": { "unit": "px", "value": 16.0 }, "padding-top": { "unit": "px", "value": 2.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-shrink": 1.0, "overflow": "scroll" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 8490, "height": null, "height-mode": "undefined", "output-height": 19.66666603088379, "output-width": 102.33333587646484, "width": 312.0, "width-mode": "at-most" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 0.0, "margin-right": { "unit": "px", "value": 16.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 2.0 }, "margin-right": { "unit": "px", "value": 4.0 }, "margin-top": { "unit": "px", "value": 1.5 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 8229, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 142.3333282470703, "width": 209.66665649414063, "width-mode": "at-most" }, { "duration-ns": 4375, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 133.0, "width": 133.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-shrink": 1.0, "padding-top": { "unit": "px", "value": 0.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7813, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 11.333333015441895, "width": 209.66665649414063, "width-mode": "at-most" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "padding-top": { "unit": "px", "value": 0.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7239, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 45.33333206176758, "width": 209.66665649414063, "width-mode": "at-most" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "padding-top": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "flex-end", "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 16.0 }, "padding-vertical": { "unit": "px", "value": 12.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 27604, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 17969, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 32448, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13906, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 17136, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13854, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 17187, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 14791, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 16302, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 20573, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 14063, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 12396, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13125, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 14271, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15573, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 22917, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15052, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 17709, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 11459, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 16041, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 16563, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15625, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 22968, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 17031, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 10.0 }, "position-left": { "unit": "px", "value": -5.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 10.0 }, "position-left": { "unit": "px", "value": -5.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 1.0 }, "position-left": { "unit": "px", "value": -5.0 }, "width": { "unit": "px", "value": 10.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-self": "center", "flex-grow": 1.0, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 0.3333333432674408 }, "margin-horizontal": { "unit": "px", "value": 16.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 0.3333333432674408 }, "margin-horizontal": { "unit": "px", "value": 16.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 32.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 32.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 32.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-right": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7656, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 102.0, "width": 102.0, "width-mode": "exactly" } ] }, "style": { "flex": 1.0, "margin-bottom": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "padding-vertical": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7396, "height": null, "height-mode": "undefined", "output-height": 15.333333015441895, "output-width": 102.0, "width": 102.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.6666667461395264 }, "margin-top": { "unit": "px", "value": -2.6666667461395264 }, "padding-bottom": { "unit": "px", "value": 5.0 }, "padding-top": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0, "padding-right": { "unit": "px", "value": 4.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "height": { "unit": "px", "value": 24.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": -4.0 }, "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row", "justify-content": "center", "padding-bottom": { "unit": "px", "value": 10.0 }, "padding-left": { "unit": "px", "value": 8.0 }, "padding-right": { "unit": "px", "value": 8.0 }, "padding-top": { "unit": "px", "value": 10.0 }, "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "height": { "unit": "px", "value": 178.0 }, "overflow": "scroll", "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 6.0 }, "margin-right": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 6.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 6.0 }, "margin-right": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 6.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 6.0 }, "margin-right": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 6.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 6.0 }, "margin-right": { "unit": "px", "value": 4.0 }, "width": { "unit": "px", "value": 6.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 6.0 }, "margin-right": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "padding-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "position-bottom": { "unit": "px", "value": 8.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 9115, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 32.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 32.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 32.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-right": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7188, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 102.0, "width": 102.0, "width-mode": "exactly" } ] }, "style": { "flex": 1.0, "margin-bottom": { "unit": "px", "value": -4.0 }, "margin-top": { "unit": "px", "value": -3.3333332538604736 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "padding-vertical": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 5834, "height": null, "height-mode": "undefined", "output-height": 15.333333015441895, "output-width": 102.0, "width": 102.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.6666667461395264 }, "margin-top": { "unit": "px", "value": -2.6666667461395264 }, "padding-bottom": { "unit": "px", "value": 5.0 }, "padding-top": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0, "padding-right": { "unit": "px", "value": 4.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "height": { "unit": "px", "value": 24.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": -4.0 }, "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row", "justify-content": "center", "padding-bottom": { "unit": "px", "value": 10.0 }, "padding-left": { "unit": "px", "value": 8.0 }, "padding-right": { "unit": "px", "value": 8.0 }, "padding-top": { "unit": "px", "value": 10.0 }, "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 8854, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 0.3333333432674408 }, "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-horizontal": { "unit": "px", "value": 16.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15677, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 14323, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "padding-bottom": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": null }, "style": { "height": { "unit": "px", "value": 178.0 }, "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 14635, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13906, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15677, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": null }, "style": { "height": { "unit": "px", "value": 178.0 }, "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 14636, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "padding-bottom": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 11928, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15312, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "padding-bottom": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 0.3333333432674408 }, "margin-horizontal": { "unit": "px", "value": 16.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 32.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 32.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 32.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-right": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 5938, "height": null, "height-mode": "undefined", "output-height": 19.66666603088379, "output-width": 280.0, "width": 280.0, "width-mode": "exactly" } ] }, "style": { "flex": 1.0, "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "padding-vertical": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7292, "height": null, "height-mode": "undefined", "output-height": 15.333333015441895, "output-width": 280.0, "width": 280.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.6666667461395264 }, "margin-top": { "unit": "px", "value": -2.6666667461395264 }, "padding-bottom": { "unit": "px", "value": 5.0 }, "padding-top": { "unit": "px", "value": 3.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0 } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "height": { "unit": "px", "value": 24.0 }, "justify-content": "center", "margin-horizontal": { "unit": "px", "value": -4.0 }, "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "flex-direction": "row", "justify-content": "center", "padding-bottom": { "unit": "px", "value": 10.0 }, "padding-left": { "unit": "px", "value": 12.0 }, "padding-right": { "unit": "px", "value": 12.0 }, "padding-top": { "unit": "px", "value": 10.0 }, "width": { "unit": "px", "value": 360.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 1660833, "height": 178.0, "height-mode": "at-most", "output-height": 178.0, "output-width": 178.0, "width": 178.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "height": { "unit": "px", "value": 178.0 }, "justify-content": "center", "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 10313, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 10782, "height": null, "height-mode": "undefined", "output-height": 17.66666603088379, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "padding-bottom": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 0.3333333432674408 }, "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-horizontal": { "unit": "px", "value": 16.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13073, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 15000, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13750, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 178.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "border-all": { "unit": "px", "value": 1.0 }, "height": { "unit": "px", "value": 178.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden" } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 13541, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 170.0, "width": 170.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "margin-end": { "unit": "px", "value": 0.0 }, "margin-start": { "unit": "px", "value": 8.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 178.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "justify-content": "space-between" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 4.0 }, "margin-horizontal": { "unit": "px", "value": 0.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "padding-bottom": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 10.0 }, "position-left": { "unit": "px", "value": -5.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 11.0 }, "margin-top": { "unit": "px", "value": 11.0 }, "width": { "unit": "px", "value": 145.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 178.0 }, "width": { "unit": "px", "value": 178.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 11.0 }, "margin-top": { "unit": "px", "value": 11.0 }, "width": { "unit": "px", "value": 145.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "space-between", "padding-bottom": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 10.0 }, "position-left": { "unit": "px", "value": -5.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 10.0 }, "position-left": { "unit": "px", "value": -5.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "padding-top": { "unit": "px", "value": 0.5 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-self": "center", "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll", "width": { "unit": "px", "value": 360.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "px", "value": 360.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0, "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0 } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 17031, "height": null, "height-mode": "undefined", "output-height": 8.333333015441895, "output-width": 57.66666793823242, "width": 356.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "justify-content": "center", "padding-all": { "unit": "px", "value": 2.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "max-height": { "unit": "px", "value": 604.3333129882813 }, "max-width": { "unit": "px", "value": 360.0 }, "min-height": { "unit": "px", "value": 604.3333129882813 }, "min-width": { "unit": "px", "value": 360.0 } } } } ================================================ FILE: benchmark/captures/profile-ios.json ================================================ { "layout-inputs": { "available-height": 821.0, "available-width": 430.0, "owner-direction": "ltr" }, "tree": { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 6.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 6.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "height": { "unit": "px", "value": 9.0 }, "justify-content": "center", "position-end": { "unit": "px", "value": 1.5 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 9.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 6958, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 66.0, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -3.6666667461395264 }, "margin-top": { "unit": "px", "value": -4.666666507720947 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "margin-end": { "unit": "px", "value": 8.0 }, "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 6375, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 73.33333587646484, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -3.6666667461395264 }, "margin-top": { "unit": "px", "value": -4.666666507720947 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "margin-end": { "unit": "px", "value": 8.0 }, "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 4250, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 59.66666793823242, "width": null, "width-mode": "undefined" } ] }, "style": { "flex-shrink": 1.0, "margin-bottom": { "unit": "px", "value": -3.6666667461395264 }, "margin-top": { "unit": "px", "value": -4.666666507720947 }, "padding-vertical": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "justify-content": "center", "margin-end": { "unit": "px", "value": 8.0 }, "min-height": { "unit": "px", "value": 36.0 }, "min-width": { "unit": "px", "value": 44.0 }, "padding-horizontal": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "padding-horizontal": { "unit": "px", "value": 8.0 }, "padding-top": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-horizontal": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 16.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "padding-right": { "unit": "px", "value": 10.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 8000, "height": null, "height-mode": "undefined", "output-height": 40.0, "output-width": 286.3999938964844, "width": 286.3999938964844, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 3.6666667461395264 }, "margin-top": { "unit": "px", "value": -4.333333492279053 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 11750, "height": null, "height-mode": "undefined", "output-height": 40.0, "output-width": 286.3999938964844, "width": 286.3999938964844, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 8.333333015441895 }, "margin-top": { "unit": "px", "value": -4.666666507720947 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "width": { "unit": "pct", "value": 80.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex-direction": "row", "height": { "unit": "px", "value": 36.0 }, "justify-content": "center", "padding-horizontal": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-self": "center", "flex-direction": "row", "flex-shrink": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-all": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 20.0 }, "margin-horizontal": { "unit": "px", "value": 20.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "overflow": "hidden", "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 32.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 64.80000305175781 }, "margin-right": { "unit": "px", "value": 16.0 }, "width": { "unit": "px", "value": 64.80000305175781 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 32.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 32.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 64.80000305175781 }, "width": { "unit": "px", "value": 64.80000305175781 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "justify-content": "flex-end", "position-right": { "unit": "px", "value": 16.0 }, "position-top": { "unit": "px", "value": -32.400001525878906 }, "position-type": "absolute" } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 6083, "height": null, "height-mode": "undefined", "output-height": 28.0, "output-width": 358.0, "width": 358.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": 6.0 }, "margin-top": { "unit": "px", "value": -6.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 7417, "height": null, "height-mode": "undefined", "output-height": 20.0, "output-width": 358.0, "width": 358.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -4.333333492279053 }, "margin-top": { "unit": "px", "value": -4.333333492279053 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "padding-bottom": { "unit": "px", "value": 20.0 }, "padding-left": { "unit": "px", "value": 16.0 }, "padding-right": { "unit": "px", "value": 16.0 }, "padding-top": { "unit": "px", "value": 20.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 468.0 }, "margin-horizontal": { "unit": "px", "value": 20.0 }, "margin-vertical": { "unit": "px", "value": 0.0 }, "width": { "unit": "px", "value": 390.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center", "max-height": { "unit": "px", "value": 60.0 }, "min-height": { "unit": "px", "value": 60.0 }, "width": { "unit": "px", "value": 60.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 4416, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 84.0, "width": 84.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.3333332538604736 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-top": { "unit": "px", "value": 8.0 }, "width": { "unit": "px", "value": 84.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 0.0 }, "margin-top": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center", "max-height": { "unit": "px", "value": 60.0 }, "min-height": { "unit": "px", "value": 60.0 }, "width": { "unit": "px", "value": 60.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 2875, "height": null, "height-mode": "undefined", "output-height": 32.0, "output-width": 84.0, "width": 84.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.3333332538604736 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-top": { "unit": "px", "value": 8.0 }, "width": { "unit": "px", "value": 84.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 0.0 }, "margin-top": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center", "max-height": { "unit": "px", "value": 60.0 }, "min-height": { "unit": "px", "value": 60.0 }, "width": { "unit": "px", "value": 60.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 3167, "height": null, "height-mode": "undefined", "output-height": 16.0, "output-width": 84.0, "width": 84.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.3333332538604736 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-top": { "unit": "px", "value": 8.0 }, "width": { "unit": "px", "value": 84.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 0.0 }, "margin-top": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center", "max-height": { "unit": "px", "value": 60.0 }, "min-height": { "unit": "px", "value": 60.0 }, "width": { "unit": "px", "value": 60.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 6708, "height": null, "height-mode": "undefined", "output-height": 32.0, "output-width": 84.0, "width": 84.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.3333332538604736 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-top": { "unit": "px", "value": 8.0 }, "width": { "unit": "px", "value": 84.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 0.0 }, "margin-top": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 24.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 24.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0, "justify-content": "center", "max-height": { "unit": "px", "value": 60.0 }, "min-height": { "unit": "px", "value": 60.0 }, "width": { "unit": "px", "value": 60.0 } } }, { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 2500, "height": null, "height-mode": "undefined", "output-height": 32.0, "output-width": 84.0, "width": 84.0, "width-mode": "exactly" } ] }, "style": { "margin-bottom": { "unit": "px", "value": -3.3333332538604736 }, "margin-top": { "unit": "px", "value": -4.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-top": { "unit": "px", "value": 8.0 }, "width": { "unit": "px", "value": 84.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 16.0 }, "margin-left": { "unit": "px", "value": 0.0 }, "margin-top": { "unit": "px", "value": 16.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "padding-right": { "unit": "px", "value": 20.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-direction": "row", "flex-grow": 1.0, "flex-shrink": 1.0, "margin-left": { "unit": "px", "value": 20.0 }, "margin-right": { "unit": "px", "value": 0.0 }, "margin-top": { "unit": "px", "value": 0.0 }, "overflow": "scroll" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "margin-bottom": { "unit": "px", "value": 0.0 }, "margin-vertical": { "unit": "px", "value": 12.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "pct", "value": 100.0 }, "padding-bottom": { "unit": "px", "value": 12.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "flex-shrink": 1.0, "overflow": "scroll" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0, "padding-bottom": { "unit": "px", "value": 34.0 }, "padding-left": { "unit": "px", "value": 0.0 }, "padding-right": { "unit": "px", "value": 0.0 }, "padding-top": { "unit": "px", "value": 0.0 } } }, { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "height": { "unit": "px", "value": 10.0 }, "position-left": { "unit": "px", "value": -5.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 10.0 } } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0, "height": "undefined", "width": "undefined" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex-grow": 1.0 } }, { "children": [ { "children": [ { "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": { "measure-funcs": [ { "duration-ns": 3292, "height": null, "height-mode": "undefined", "output-height": 7.333333492279053, "output-width": 67.66666412353516, "width": 426.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": null } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "align-items": "center", "justify-content": "center", "padding-all": { "unit": "px", "value": 2.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 3.0 }, "node": null, "style": { "max-height": { "unit": "px", "value": 821.0 }, "max-width": { "unit": "px", "value": 430.0 }, "min-height": { "unit": "px", "value": 821.0 }, "min-width": { "unit": "px", "value": 430.0 } } } } ================================================ FILE: benchmark/captures/rendering-sample-mac.json ================================================ { "layout-inputs": { "available-height": 720.0, "available-width": 1080.0, "owner-direction": "ltr" }, "tree": { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8167, "height": null, "height-mode": "undefined", "output-height": 295.0, "output-width": 816.0, "width": null, "width-mode": "undefined" } ] }, "style": { "margin-all": { "unit": "px", "value": 25.0 }, "min-width": { "unit": "px", "value": 2000.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-top": { "unit": "px", "value": 350.0 }, "position-type": "absolute" } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 1052.0 }, "overflow": "hidden", "position-left": { "unit": "px", "value": 100.0 }, "position-top": { "unit": "px", "value": -35.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 1210.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 495.0 }, "overflow": "hidden", "position-left": { "unit": "px", "value": 595.0 }, "position-top": { "unit": "px", "value": 250.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 459.0 } } }, { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 320.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 320.0 } } } ], "config": { "errata": "all" }, "style": { "flex-direction": "row", "flex-wrap": "wrap", "height": { "unit": "pct", "value": 100.0 }, "position-type": "absolute", "width": { "unit": "pct", "value": 100.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 24625, "height": null, "height-mode": "undefined", "output-height": 330.0, "output-width": 408.0, "width": 647.3333129882813, "width-mode": "at-most" } ] }, "style": { "margin-all": { "unit": "px", "value": 25.0 }, "min-width": { "unit": "px", "value": 1000.0 }, "position-left": { "unit": "px", "value": -30.0 }, "position-top": { "unit": "px", "value": 10.0 }, "position-type": "absolute" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 9625, "height": null, "height-mode": "undefined", "output-height": 448.0, "output-width": 562.5, "width": 647.3333129882813, "width-mode": "at-most" } ] }, "style": { "margin-all": { "unit": "px", "value": 25.0 }, "min-width": { "unit": "px", "value": 1000.0 }, "position-left": { "unit": "px", "value": 20.0 }, "position-top": { "unit": "px", "value": 140.0 }, "position-type": "absolute" } }, { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8417, "height": null, "height-mode": "undefined", "output-height": 100.0, "output-width": 294.0, "width": 647.3333129882813, "width-mode": "at-most" } ] }, "style": { "margin-all": { "unit": "px", "value": 25.0 }, "min-width": { "unit": "px", "value": 1000.0 }, "position-left": { "unit": "px", "value": 520.0 }, "position-top": { "unit": "px", "value": 120.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "flex": 2.0, "margin-all": { "unit": "px", "value": 5.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 9166, "height": 676.0, "height-mode": "at-most", "output-height": 94.0, "output-width": 328.6666564941406, "width": 328.6666564941406, "width-mode": "exactly" } ] }, "style": { "padding-all": { "unit": "px", "value": 10.0 } } }, { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8250, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8625, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7250, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6833, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7042, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6208, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6834, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8500, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6750, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6667, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8958, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 8125, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6541, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6541, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 6333, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } }, { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7875, "height": 566.0, "height-mode": "at-most", "output-height": 21.0, "output-width": 158.33331298828125, "width": 158.33331298828125, "width-mode": "exactly" } ] }, "style": { "margin-all": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": null } ], "config": { "errata": "all" }, "style": { "width": { "unit": "pct", "value": 50.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-wrap": "wrap" } } ], "config": { "errata": "all" }, "style": { "border-all": { "unit": "px", "value": 2.0 }, "flex": 1.0, "margin-all": { "unit": "px", "value": 10.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "flex-direction": "row", "height": { "unit": "pct", "value": 100.0 }, "width": { "unit": "pct", "value": 100.0 } } }, { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 50.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-left": { "unit": "px", "value": 0.0 }, "position-type": "absolute", "width": { "unit": "px", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0, "height": { "unit": "pct", "value": 100.0 }, "min-height": { "unit": "px", "value": 720.0 }, "min-width": { "unit": "px", "value": 800.0 }, "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 7583, "height": null, "height-mode": "undefined", "output-height": 7.0, "output-width": 70.5, "width": 1076.0, "width-mode": "at-most" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "align-items": "center", "justify-content": "center", "padding-all": { "unit": "px", "value": 2.0 }, "position-bottom": { "unit": "px", "value": 0.0 }, "position-right": { "unit": "px", "value": 0.0 }, "position-type": "absolute" } }, { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": [ { "duration-ns": 478791, "height": 44.0, "height-mode": "at-most", "output-height": 18.0, "output-width": 5.0, "width": 1016.0, "width-mode": "at-most" }, { "duration-ns": 61250, "height": 44.0, "height-mode": "at-most", "output-height": 18.0, "output-width": 10.0, "width": 10.0, "width-mode": "exactly" } ] }, "style": null } ], "config": { "errata": "all" }, "style": { "min-width": { "unit": "px", "value": 18.0 }, "padding-left": { "unit": "px", "value": 4.0 }, "padding-right": { "unit": "px", "value": 4.0 } } } ], "config": { "errata": "all" }, "style": { "margin-right": { "unit": "px", "value": 8.0 }, "padding-all": { "unit": "px", "value": 2.0 } } }, { "children": [ { "config": { "errata": "all" }, "node": { "measure-funcs": null }, "style": { "flex": 1.0 } } ], "config": { "errata": "all" }, "style": { "align-self": "stretch", "border-left": { "unit": "px", "value": 1.0 }, "flex-grow": 1.0, "flex-shrink": 1.0, "padding-left": { "unit": "px", "value": 8.0 } } }, { "children": [ { "children": [ { "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 8.0 }, "overflow": "hidden", "width": { "unit": "px", "value": 8.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "center", "align-self": "flex-end", "height": { "unit": "px", "value": 20.0 }, "justify-content": "center", "width": { "unit": "px", "value": 20.0 } } } ], "config": { "errata": "all" }, "style": { "align-self": "center", "flex-direction": "row", "margin-left": { "unit": "px", "value": 5.0 } } } ], "config": { "errata": "all" }, "style": { "align-items": "flex-start", "flex-direction": "row" } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 48.0 }, "justify-content": "center", "margin-top": { "unit": "px", "value": 0.5 }, "padding-horizontal": { "unit": "px", "value": 12.0 }, "position-type": "relative", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "height": { "unit": "px", "value": 48.0 }, "justify-content": "center", "margin-top": { "unit": "px", "value": 0.5 }, "position-type": "relative", "width": { "unit": "pct", "value": 100.0 } } } ], "config": { "errata": "all" }, "style": { "margin-bottom": { "unit": "px", "value": 5.0 }, "overflow": "hidden" } } ], "config": { "errata": "all" }, "style": { "position-bottom": { "unit": "px", "value": 20.0 }, "position-left": { "unit": "px", "value": 10.0 }, "position-right": { "unit": "px", "value": 10.0 }, "position-type": "absolute" } } ], "config": { "errata": "all" }, "style": { "flex": 1.0 } } ], "config": { "errata": "all", "point-scale-factor": 2.0 }, "style": { "max-height": { "unit": "px", "value": 720.0 }, "max-width": { "unit": "px", "value": 1080.0 }, "min-height": { "unit": "px", "value": 720.0 }, "min-width": { "unit": "px", "value": 1080.0 } } } } ================================================ FILE: build.gradle ================================================ /* * 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. */ plugins { id("com.android.library") version "8.12.0" apply false id("com.android.application") version "8.12.0" apply false id("io.github.gradle-nexus.publish-plugin") version "2.0.0" id 'org.jetbrains.kotlin.android' version '2.1.20' apply false } allprojects { repositories { google() mavenCentral() } } group = "com.facebook.yoga" if (project.hasProperty("USE_SNAPSHOT") && project.property("USE_SNAPSHOT").toBoolean()) { version = getProperty("VERSION_NAME") + "-SNAPSHOT" } else { version = getProperty("VERSION_NAME") } def sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString() def sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString() nexusPublishing { repositories { 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/")) } } } task clean(type: Delete) { delete rootProject.layout.buildDirectory } ================================================ FILE: build_fuzz_tests ================================================ #!/usr/bin/env sh # 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. if [ "$#" -eq 0 ]; then build_type="Debug" else build_type="$1" fi export CC=clang export CXX=clang++ # Make sure libc++ isn't used, as libfuzzer is linked against stdlibc++ which causes conflicts unset CXXFLAGS export LDFLAGS=-lstdc++ if which ninja; then set -e cmake -B build -S . -D BUILD_FUZZ_TESTS=ON -D CMAKE_BUILD_TYPE="$build_type" -G Ninja else set -e cmake -B build -S . -D BUILD_FUZZ_TESTS=ON -D CMAKE_BUILD_TYPE="$build_type" fi cmake --build build --target fuzz_layout ================================================ FILE: capture/CMakeLists.txt ================================================ # 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. cmake_minimum_required(VERSION 3.13...3.26) project(capture) set(CMAKE_VERBOSE_MAKEFILE on) set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) include(${YOGA_ROOT}/cmake/project-defaults.cmake) add_subdirectory(${YOGA_ROOT}/yoga ${CMAKE_CURRENT_BINARY_DIR}/yoga) file(GLOB SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_library(capture STATIC ${SOURCES}) target_link_libraries(capture yogacore) target_include_directories(capture PUBLIC $ $) ================================================ FILE: capture/CaptureTree.cpp ================================================ /* * 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. */ #include #include #include #include #include namespace facebook::yoga { using namespace nlohmann; static void captureTree( std::string_view serializedTree, const std::filesystem::path& path) { std::ofstream file(path); file << serializedTree; } static SerializedMeasureFuncMap& currentSerializedMeasureFuncMap() { static thread_local SerializedMeasureFuncMap map{}; return map; } /* * Capturing a tree often means that we capturing multiple serial layouts over * the course of the capture. Because of this, we need to make sure that we do * a full layout pass with no caching. If we do not do this there is a chance * we do not capture measure functions that were called and cached in previous * layouts. Missing these captures would lead to inaccurate benchmarking where * we do not have cached state. * * TODO: Dirty entire tree not just measure function nodes */ static void dirtyTree(YGNodeRef node) { if (YGNodeHasMeasureFunc(node)) { YGNodeMarkDirty(node); } const size_t childCount = YGNodeGetChildCount(node); for (size_t i = 0; i < childCount; i++) { dirtyTree(YGNodeGetChild(node, i)); } } void YGNodeCalculateLayoutWithCapture( YGNodeRef node, float availableWidth, float availableHeight, YGDirection ownerDirection, const std::filesystem::path& path) { dirtyTree(node); YGNodeCalculateLayout(node, availableWidth, availableHeight, ownerDirection); json j; serializeLayoutInputs(j, availableWidth, availableHeight, ownerDirection); serializeTree( j, currentSerializedMeasureFuncMap(), node, PrintOptions::Style | PrintOptions::Children | PrintOptions::Config | PrintOptions::Node); // TODO: It is possible to have a measure function call layout again if, e.g., // views are nested in text. Need to be able to resolve this special case. currentSerializedMeasureFuncMap().clear(); captureTree(j.dump(2), path); } void captureMeasureFunc( YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode, YGSize output, std::chrono::steady_clock::duration durationNs) { auto measureFuncIt = currentSerializedMeasureFuncMap().find(node); if (measureFuncIt == currentSerializedMeasureFuncMap().end()) { std::vector vec{}; currentSerializedMeasureFuncMap().insert(std::make_pair(node, vec)); } measureFuncIt = currentSerializedMeasureFuncMap().find(node); assert(measureFuncIt != currentSerializedMeasureFuncMap().end()); measureFuncIt->second.push_back( {width, widthMode, height, heightMode, output.width, output.height, durationNs.count()}); } } // namespace facebook::yoga ================================================ FILE: capture/CaptureTree.h ================================================ /* * 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. */ #pragma once #include #include #include #include namespace facebook::yoga { struct SerializedMeasureFunc { float inputWidth{0.0f}; YGMeasureMode widthMode{YGMeasureModeUndefined}; float inputHeight{0.0}; YGMeasureMode heightMode{YGMeasureModeUndefined}; float outputWidth{0.0f}; float outputHeight{0.0f}; std::chrono::steady_clock::duration::rep durationNs{}; }; using SerializedMeasureFuncMap = std::unordered_map>; void YGNodeCalculateLayoutWithCapture( YGNodeRef node, float availableWidth, float availableHeight, YGDirection ownerDirection, const std::filesystem::path& path); void captureMeasureFunc( YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode, YGSize output, std::chrono::steady_clock::duration durationNs); } // namespace facebook::yoga ================================================ FILE: capture/NodeToString.cpp ================================================ /* * 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. */ #include #include #include namespace facebook::yoga { using namespace nlohmann; static void appendFloatIfNotDefault( json& j, std::string_view key, float num, float defaultNum) { if (num != defaultNum && !YGFloatIsUndefined(num)) { j[key] = num; } } static void appendYGValueIfNotDefault( json& j, std::string_view key, const YGValue& value, const YGValue& defaultValue) { if (value != defaultValue) { if (value.unit == YGUnitAuto) { j[key] = "auto"; } else if (value.unit == YGUnitUndefined) { j[key] = "undefined"; } else { std::string unit = value.unit == YGUnitPoint ? "px" : "pct"; j[key]["value"] = value.value; j[key]["unit"] = unit; } } } static void appendEnumValueIfNotDefault( json& j, std::string_view key, std::string_view value, std::string_view defaultValue) { if (value != defaultValue) { j[key] = value; } } static void appendBoolIfNotDefault( json& j, std::string_view key, bool value, bool defaultValue) { if (value != defaultValue) { j[key] = value; } } template static void appendEdges( json& j, const std::string& key, YGNodeRef node, YGNodeRef defaultNode) { appendYGValueIfNotDefault( j["style"], key + "-left", (*Field)(node, YGEdgeLeft), (*Field)(defaultNode, YGEdgeLeft)); appendYGValueIfNotDefault( j["style"], key + "-right", (*Field)(node, YGEdgeRight), (*Field)(defaultNode, YGEdgeRight)); appendYGValueIfNotDefault( j["style"], key + "-top", (*Field)(node, YGEdgeTop), (*Field)(defaultNode, YGEdgeTop)); appendYGValueIfNotDefault( j["style"], key + "-bottom", (*Field)(node, YGEdgeBottom), (*Field)(defaultNode, YGEdgeBottom)); appendYGValueIfNotDefault( j["style"], key + "-all", (*Field)(node, YGEdgeAll), (*Field)(defaultNode, YGEdgeAll)); appendYGValueIfNotDefault( j["style"], key + "-start", (*Field)(node, YGEdgeStart), (*Field)(defaultNode, YGEdgeStart)); appendYGValueIfNotDefault( j["style"], key + "-end", (*Field)(node, YGEdgeEnd), (*Field)(defaultNode, YGEdgeEnd)); appendYGValueIfNotDefault( j["style"], key + "-vertical", (*Field)(node, YGEdgeVertical), (*Field)(defaultNode, YGEdgeVertical)); appendYGValueIfNotDefault( j["style"], key + "-horizontal", (*Field)(node, YGEdgeHorizontal), (*Field)(defaultNode, YGEdgeHorizontal)); } static YGValue borderFloatToYGValue(YGNodeRef node, YGEdge edge) { float val = YGNodeStyleGetBorder(node, edge); YGUnit unit = YGFloatIsUndefined(val) ? YGUnitUndefined : YGUnitPoint; return YGValue{val, unit}; } static void serializeMeasureFuncResults( json& j, std::vector& measureFuncs) { for (auto measureFunc : measureFuncs) { j["measure-funcs"].push_back( {{"width", measureFunc.inputWidth}, {"width-mode", YGMeasureModeToString(measureFunc.widthMode)}, {"height", measureFunc.inputHeight}, {"height-mode", YGMeasureModeToString(measureFunc.heightMode)}, {"output-width", measureFunc.outputWidth}, {"output-height", measureFunc.outputHeight}, {"duration-ns", measureFunc.durationNs}}); } } static void serializeTreeImpl( json& j, SerializedMeasureFuncMap& nodesToMeasureFuncs, YGNodeRef node, PrintOptions options) { if ((options & PrintOptions::Layout) == PrintOptions::Layout) { j["layout"]["width"] = YGNodeStyleGetWidth(node).value; j["layout"]["height"] = YGNodeStyleGetHeight(node).value; j["layout"]["top"] = YGNodeStyleGetPosition(node, YGEdgeTop).value; j["layout"]["left"] = YGNodeStyleGetPosition(node, YGEdgeLeft).value; } std::unique_ptr defaultNode( YGNodeNew(), YGNodeFree); if ((options & PrintOptions::Style) == PrintOptions::Style) { appendEnumValueIfNotDefault( j["style"], "flex-direction", YGFlexDirectionToString(YGNodeStyleGetFlexDirection(node)), YGFlexDirectionToString( YGNodeStyleGetFlexDirection(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "justify-content", YGJustifyToString(YGNodeStyleGetJustifyContent(node)), YGJustifyToString(YGNodeStyleGetJustifyContent(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "align-items", YGAlignToString(YGNodeStyleGetAlignItems(node)), YGAlignToString(YGNodeStyleGetAlignItems(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "align-content", YGAlignToString(YGNodeStyleGetAlignContent(node)), YGAlignToString(YGNodeStyleGetAlignContent(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "align-self", YGAlignToString(YGNodeStyleGetAlignSelf(node)), YGAlignToString(YGNodeStyleGetAlignSelf(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "flex-wrap", YGWrapToString(YGNodeStyleGetFlexWrap(node)), YGWrapToString(YGNodeStyleGetFlexWrap(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "overflow", YGOverflowToString(YGNodeStyleGetOverflow(node)), YGOverflowToString(YGNodeStyleGetOverflow(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "display", YGDisplayToString(YGNodeStyleGetDisplay(node)), YGDisplayToString(YGNodeStyleGetDisplay(defaultNode.get()))); appendEnumValueIfNotDefault( j["style"], "position-type", YGPositionTypeToString(YGNodeStyleGetPositionType(node)), YGPositionTypeToString(YGNodeStyleGetPositionType(defaultNode.get()))); appendFloatIfNotDefault( j["style"], "flex-grow", YGNodeStyleGetFlexGrow(node), YGNodeStyleGetFlexGrow(defaultNode.get())); appendFloatIfNotDefault( j["style"], "flex-shrink", YGNodeStyleGetFlexShrink(node), YGNodeStyleGetFlexShrink(defaultNode.get())); appendFloatIfNotDefault( j["style"], "flex", YGNodeStyleGetFlex(node), YGNodeStyleGetFlex(defaultNode.get())); appendYGValueIfNotDefault( j["style"], "flex-basis", YGNodeStyleGetFlexBasis(node), YGNodeStyleGetFlexBasis(defaultNode.get())); appendEdges<&YGNodeStyleGetMargin>(j, "margin", node, defaultNode.get()); appendEdges<&YGNodeStyleGetPadding>(j, "padding", node, defaultNode.get()); appendEdges<&borderFloatToYGValue>(j, "border", node, defaultNode.get()); appendEdges<&YGNodeStyleGetPosition>( j, "position", node, defaultNode.get()); appendYGValueIfNotDefault( j["style"], "gap", YGNodeStyleGetGap(node, YGGutterAll), YGNodeStyleGetGap(defaultNode.get(), YGGutterAll)); appendYGValueIfNotDefault( j["style"], "column-gap", YGNodeStyleGetGap(node, YGGutterColumn), YGNodeStyleGetGap(defaultNode.get(), YGGutterColumn)); appendYGValueIfNotDefault( j["style"], "row-gap", YGNodeStyleGetGap(node, YGGutterRow), YGNodeStyleGetGap(defaultNode.get(), YGGutterRow)); appendYGValueIfNotDefault( j["style"], "width", YGNodeStyleGetWidth(node), YGNodeStyleGetWidth(defaultNode.get())); appendYGValueIfNotDefault( j["style"], "height", YGNodeStyleGetHeight(node), YGNodeStyleGetHeight(defaultNode.get())); appendYGValueIfNotDefault( j["style"], "max-width", YGNodeStyleGetMaxWidth(node), YGNodeStyleGetMaxWidth(defaultNode.get())); appendYGValueIfNotDefault( j["style"], "max-height", YGNodeStyleGetMaxHeight(node), YGNodeStyleGetMaxHeight(defaultNode.get())); appendYGValueIfNotDefault( j["style"], "min-width", YGNodeStyleGetMinWidth(node), YGNodeStyleGetMinWidth(defaultNode.get())); appendYGValueIfNotDefault( j["style"], "min-height", YGNodeStyleGetMinHeight(node), YGNodeStyleGetMinHeight(defaultNode.get())); } if ((options & PrintOptions::Config) == PrintOptions::Config) { YGConfigConstRef config = YGNodeGetConfig(node); YGConfigConstRef defaultConfig = YGConfigGetDefault(); appendBoolIfNotDefault( j["config"], "use-web-defaults", YGConfigGetUseWebDefaults(config), YGConfigGetUseWebDefaults(defaultConfig)); appendFloatIfNotDefault( j["config"], "point-scale-factor", YGConfigGetPointScaleFactor(config), YGConfigGetPointScaleFactor(defaultConfig)); YGErrata errata = YGConfigGetErrata(config); if (errata == YGErrataNone || errata == YGErrataAll || errata == YGErrataClassic) { appendEnumValueIfNotDefault( j["config"], "errata", YGErrataToString(errata), YGErrataToString(YGConfigGetErrata(defaultConfig))); } if (YGConfigIsExperimentalFeatureEnabled( config, YGExperimentalFeatureWebFlexBasis) != YGConfigIsExperimentalFeatureEnabled( defaultConfig, YGExperimentalFeatureWebFlexBasis)) { j["config"]["experimental-features"].push_back( YGExperimentalFeatureToString(YGExperimentalFeatureWebFlexBasis)); } } if ((options & PrintOptions::Node) == PrintOptions::Node) { appendBoolIfNotDefault( j["node"], "always-forms-containing-block", YGNodeGetAlwaysFormsContainingBlock(node), YGNodeGetAlwaysFormsContainingBlock(defaultNode.get())); if (YGNodeHasMeasureFunc(node)) { auto measureFuncIt = nodesToMeasureFuncs.find(node); if (measureFuncIt == nodesToMeasureFuncs.end()) { j["node"]["measure-funcs"]; } else { serializeMeasureFuncResults(j["node"], measureFuncIt->second); } } } const size_t childCount = YGNodeGetChildCount(node); if ((options & PrintOptions::Children) == PrintOptions::Children && childCount > 0) { for (size_t i = 0; i < childCount; i++) { j["children"].push_back({}); serializeTreeImpl( j["children"][i], nodesToMeasureFuncs, YGNodeGetChild(node, i), options); } } } void serializeTree( json& j, SerializedMeasureFuncMap& nodesToMeasureFuncs, YGNodeRef node, PrintOptions options) { serializeTreeImpl(j["tree"], nodesToMeasureFuncs, node, options); } void serializeLayoutInputs( json& j, float availableWidth, float availableHeight, YGDirection ownerDirection) { j["layout-inputs"] = { {"available-width", availableWidth}, {"available-height", availableHeight}, {"owner-direction", YGDirectionToString(ownerDirection)}, }; } } // namespace facebook::yoga ================================================ FILE: capture/NodeToString.h ================================================ /* * 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. */ #pragma once #include #include #include #include #include namespace facebook::yoga { enum class PrintOptions : uint8_t { Layout = 1 << 0, Children = 1 << 1, Style = 1 << 2, Config = 1 << 3, Node = 1 << 4, }; YG_DEFINE_ENUM_FLAG_OPERATORS(PrintOptions); void serializeTree( nlohmann::json& j, SerializedMeasureFuncMap& nodesToMeasureFuncs, YGNodeRef node, PrintOptions options); void serializeLayoutInputs( nlohmann::json& j, float availableWidth, float availableHeight, YGDirection ownerDirection); } // namespace facebook::yoga ================================================ FILE: cmake/project-defaults.cmake ================================================ # 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. set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_compile_definitions($<$:DEBUG>) if(MSVC) add_compile_options( # Don't omit frame pointers (e.g. for crash dumps) /Oy- # "Standard C++ exception handling" (C++ stack unwinding including extern c) /EHsc # Enable warnings and warnings as errors /W4 /WX # Enable RTTI $<$:/GR> # Use /O2 (Maximize Speed) $<$:/O2>) else() add_compile_options( # Don't omit frame pointers (e.g. for crash dumps) -fno-omit-frame-pointer # Enable exception handling -fexceptions # Enable warnings and warnings as errors -Wall -Werror # Enable RTTI $<$:-frtti> # Use -O2 (prioritize speed) $<$:-O2> # Enable separate sections per function/data item $<$:-ffunction-sections> $<$:-fdata-sections>) add_link_options( # Discard unused sections $<$:$<$:-Wl,--gc-sections>> $<$:$<$:-Wl,-dead_strip>>) endif() ================================================ FILE: cmake/yoga-config.cmake.in ================================================ # 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_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/yogaTargets.cmake") check_required_components(yoga) ================================================ FILE: enums.py ================================================ #!/usr/bin/env fbpython # 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. import os ENUMS = { "Direction": ["Inherit", "LTR", "RTL"], "Unit": [ "Undefined", "Point", "Percent", "Auto", "MaxContent", "FitContent", "Stretch", ], "FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"], "Justify": [ "Auto", "FlexStart", "Center", "FlexEnd", "SpaceBetween", "SpaceAround", "SpaceEvenly", "Stretch", "Start", "End", ], "Overflow": ["Visible", "Hidden", "Scroll"], "Align": [ "Auto", "FlexStart", "Center", "FlexEnd", "Stretch", "Baseline", "SpaceBetween", "SpaceAround", "SpaceEvenly", "Start", "End", ], "PositionType": ["Static", "Relative", "Absolute"], "Display": ["Flex", "None", "Contents", "Grid"], "Wrap": ["NoWrap", "Wrap", "WrapReverse"], "BoxSizing": ["BorderBox", "ContentBox"], "MeasureMode": ["Undefined", "Exactly", "AtMost"], "Dimension": ["Width", "Height"], "Edge": [ "Left", "Top", "Right", "Bottom", "Start", "End", "Horizontal", "Vertical", "All", ], "NodeType": ["Default", "Text"], "LogLevel": ["Error", "Warn", "Info", "Debug", "Verbose", "Fatal"], "ExperimentalFeature": [ # Mimic web flex-basis behavior (experiment may be broken) "WebFlexBasis", # Fix flex basis computation to not apply FitContent constraint in the # main axis for non-measure container nodes "FixFlexBasisFitContent", ], "Gutter": ["Column", "Row", "All"], "GridTrackType": ["Auto", "Points", "Percent", "Fr", "Minmax"], # Known incorrect behavior which can be enabled for compatibility "Errata": [ # Default: Standards conformant mode ("None", 0), # 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), # Absolute nodes will resolve percentages against the inner size of # their containing node, not the padding box ("AbsolutePercentAgainstInnerSize", 1 << 2), # Enable all incorrect behavior (preserve compatibility) ("All", 0x7FFFFFFF), # Enable all errata except for "StretchFlexBasis" (Defaults behavior # before Yoga 2.0) ("Classic", 0x7FFFFFFF & (~(1 << 0))), ], } # Temporary filter enums to not upgrade all enums at once KOTLIN_ENUM_NAMES = {"Direction"} ENUMS_KOTLIN = {name: ENUMS[name] for name in KOTLIN_ENUM_NAMES} ENUMS_JAVA = { name: values for name, values in ENUMS.items() if name not in KOTLIN_ENUM_NAMES } DO_NOT_STRIP = ["LogLevel"] BITSET_ENUMS = ["Errata"] def get_license(ext): return f"""{"/**" if ext == "js" else "/*"} * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @{"generated"} by enums.py {"// clang-format off" if ext == "cpp" else ""} """ def _format_name(symbol, delimiter=None, transform=None): symbol = str(symbol) out = "" for i in range(0, len(symbol)): c = symbol[i] if str.istitle(c) and i != 0 and not str.istitle(symbol[i - 1]): out += delimiter or "" if transform is None: out += c else: out += getattr(c, transform)() return out def to_java_upper(symbol): return _format_name(symbol, "_", "upper") def to_kotlin_upper(symbol): return _format_name(symbol, "_", "upper") def to_hyphenated_lower(symbol): return _format_name(symbol, "-", "lower") root = os.path.dirname(os.path.abspath(__file__)) # write out C & Objective-C headers with open(root + "/yoga/YGEnums.h", "w") as f: f.write(get_license("cpp")) f.write("#pragma once\n") f.write("#include \n\n") f.write("YG_EXTERN_C_BEGIN\n\n") items = sorted(ENUMS.items()) for name, values in items: f.write("YG_ENUM_DECL(\n") f.write(" YG%s,\n" % name) for value in values: if isinstance(value, tuple): f.write(" YG%s%s = %d" % (name, value[0], value[1])) else: f.write(" YG%s%s" % (name, value)) if value == values[-1]: f.write(")\n") else: f.write(",\n") if name in BITSET_ENUMS: f.write("YG_DEFINE_ENUM_FLAG_OPERATORS(YG%s)\n" % name) f.write("\n") f.write("YG_EXTERN_C_END\n") # Write out C++ scoped enums for name, values in sorted(ENUMS.items()): with open(f"{root}/yoga/enums/{name}.h", "w") as f: f.write(get_license("cpp")) f.write("#pragma once\n\n") f.write("#include \n") f.write("#include \n") f.write("#include \n\n") f.write("namespace facebook::yoga {\n\n") width = "uint32_t" if name in BITSET_ENUMS else "uint8_t" f.write(f"enum class {name} : {width} {{\n") for value in values: ordinal = value[0] if isinstance(value, tuple) else value f.write(f" {ordinal} = YG{name}{ordinal},\n") f.write("};\n\n") if name in BITSET_ENUMS: f.write(f"YG_DEFINE_ENUM_FLAG_OPERATORS({name})\n\n") else: f.write("template <>\n") f.write(f"constexpr int32_t ordinalCount<{name}>() {{\n") f.write(f" return {len(values)};\n") f.write("}\n\n") f.write(f"constexpr {name} scopedEnum(YG{name} unscoped) {{\n") f.write(f" return static_cast<{name}>(unscoped);\n") f.write("}\n\n") f.write(f"constexpr YG{name} unscopedEnum({name} scoped) {{\n") f.write(f" return static_cast(scoped);\n") f.write("}\n\n") f.write(f"inline const char* toString({name} e) {{\n") f.write(f" return YG{name}ToString(unscopedEnum(e));\n") f.write("}\n\n") f.write("} // namespace facebook::yoga\n") # write out C body for printing with open(root + "/yoga/YGEnums.cpp", "w") as f: f.write(get_license("cpp")) f.write("#include \n\n") items = sorted(ENUMS.items()) for name, values in items: f.write("const char* YG%sToString(const YG%s value) {\n" % (name, name)) f.write(" switch (value) {\n") for value in values: if isinstance(value, tuple): f.write(" case YG%s%s:\n" % (name, value[0])) f.write(' return "%s";\n' % to_hyphenated_lower(value[0])) else: f.write(" case YG%s%s:\n" % (name, value)) f.write(' return "%s";\n' % to_hyphenated_lower(value)) f.write(" }\n") f.write(' return "unknown";\n') f.write("}\n") if name != items[-1][0]: f.write("\n") # write out java files for name, values in sorted(ENUMS_JAVA.items()): with open(root + "/java/com/facebook/yoga/Yoga%s.java" % name, "w") as f: f.write(get_license("java")) f.write("package com.facebook.yoga;\n\n") if name in DO_NOT_STRIP: f.write("import com.facebook.yoga.annotations.DoNotStrip;\n\n") f.write("@DoNotStrip\n") f.write("public enum Yoga%s {\n" % name) if len(values) > 0: for value in values: if isinstance(value, tuple): f.write(" %s(%d)" % (to_java_upper(value[0]), value[1])) else: f.write(" %s(%d)" % (to_java_upper(value), values.index(value))) if values.index(value) is len(values) - 1: f.write(";\n") else: f.write(",\n") else: f.write("__EMPTY(-1);") f.write("\n") f.write(" private final int mIntValue;\n") f.write("\n") f.write(" Yoga%s(int intValue) {\n" % name) f.write(" mIntValue = intValue;\n") f.write(" }\n") f.write("\n") f.write(" public int intValue() {\n") f.write(" return mIntValue;\n") f.write(" }\n") f.write("\n") if name in DO_NOT_STRIP: f.write(" @DoNotStrip\n") f.write(" public static Yoga%s fromInt(int value) {\n" % name) f.write(" switch (value) {\n") for value in values: if isinstance(value, tuple): f.write( " case %d: return %s;\n" % (value[1], to_java_upper(value[0])) ) else: f.write( " case %d: return %s;\n" % (values.index(value), to_java_upper(value)) ) f.write( ' default: throw new IllegalArgumentException("Unknown enum value: " + value);\n' ) f.write(" }\n") f.write(" }\n") f.write("}\n") # write out Kotlin files for name, values in sorted(ENUMS_KOTLIN.items()): with open(root + "/java/com/facebook/yoga/Yoga%s.kt" % name, "w") as f: f.write(get_license("kotlin")) f.write("package com.facebook.yoga\n\n") f.write("public enum class Yoga%s(public val intValue: Int) {\n" % name) if len(values) > 0: for value in values: if isinstance(value, tuple): f.write(" %s(%d)" % (to_kotlin_upper(value[0]), value[1])) else: f.write(" %s(%d)" % (to_kotlin_upper(value), values.index(value))) if values.index(value) is len(values) - 1: f.write(";\n") else: f.write(",\n") else: f.write("__EMPTY(-1);") f.write("\n") f.write(" public fun intValue(): Int = intValue\n") f.write("\n") f.write(" public companion object {\n") f.write(" @JvmStatic\n") f.write(" public fun fromInt(value: Int): Yoga%s =\n" % name) f.write(" when (value) {\n") for value in values: if isinstance(value, tuple): f.write(" %d -> %s\n" % (value[1], to_kotlin_upper(value[0]))) else: f.write( " %d -> %s\n" % (values.index(value), to_kotlin_upper(value)) ) f.write( ' else -> throw IllegalArgumentException("Unknown enum value: $value")\n' ) f.write(" }\n") f.write(" }\n") f.write("}\n") # write out TypeScript file with open(root + "/javascript/src/generated/YGEnums.ts", "w") as f: f.write(get_license("js")) enums = sorted(ENUMS.items()) for enum_name, ordinals in enums: f.write(f"export enum {enum_name} {{\n") for ordinal_index, ordinal in enumerate(ordinals): ordinal_name = ordinal[0] if isinstance(ordinal, tuple) else ordinal ordinal_value = ordinal[1] if isinstance(ordinal, tuple) else ordinal_index f.write(f" {ordinal_name} = {ordinal_value},\n") f.write("}\n\n") f.write("const constants = {\n") for enum_name, ordinals in enums: for ordinal in ordinals: ordinal_name = ordinal[0] if isinstance(ordinal, tuple) else ordinal ordinal_value = ordinal[1] if isinstance(ordinal, tuple) else ordinal_index f.write( f" {to_java_upper(enum_name)}_{to_java_upper(ordinal_name)}: {enum_name}.{ordinal_name},\n" ) f.write("}\n") f.write("export default constants") ================================================ FILE: fuzz/CMakeLists.txt ================================================ # 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. # If google/oss-fuzz has set the fuzzing engine if(DEFINED ENV{LIB_FUZZING_ENGINE}) set(FUZZING_ENGINE $ENV{LIB_FUZZING_ENGINE}) set(FUZZING_COMPILE_FLAGS "") set(FUZZING_LINK_FLAGS "${FUZZING_ENGINE}") else() set(FUZZING_COMPILE_FLAGS "-fsanitize=fuzzer") set(FUZZING_LINK_FLAGS "-fsanitize=fuzzer") endif() add_executable(fuzz_layout FuzzLayout.cpp) set_target_properties(fuzz_layout PROPERTIES COMPILE_FLAGS "${FUZZING_COMPILE_FLAGS}" LINK_FLAGS "${FUZZING_LINK_FLAGS}" ) target_link_libraries(fuzz_layout yogacore) ================================================ FILE: fuzz/FuzzLayout.cpp ================================================ /* * 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. */ #include #include #include YGFlexDirection fuzzedFlexDirection(FuzzedDataProvider& fdp) { return fdp.PickValueInArray({ YGFlexDirectionColumn, YGFlexDirectionColumnReverse, YGFlexDirectionRow, YGFlexDirectionRowReverse, }); } void fillFuzzedTree( FuzzedDataProvider& fdp, YGConfigConstRef config, YGNodeRef root, size_t depth = 0) { constexpr size_t kMaxDepth = 20; constexpr size_t kMaxChildren = 20; if (depth > kMaxDepth) { return; } size_t children = fdp.ConsumeIntegralInRange(0, kMaxChildren); for (size_t i = 0; i < children; i++) { YGNodeRef child = YGNodeNewWithConfig(config); YGNodeStyleSetFlexDirection(root, fuzzedFlexDirection(fdp)); YGNodeStyleSetWidth(child, fdp.ConsumeFloatingPoint()); YGNodeStyleSetGap( child, YGGutterAll, fdp.ConsumeProbability() * 100); YGNodeStyleSetHeight(child, fdp.ConsumeFloatingPoint()); YGNodeInsertChild(root, child, i); fillFuzzedTree(fdp, config, child, depth + 1); } } extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { FuzzedDataProvider fdp(data, size); YGConfigRef config = YGConfigNew(); YGNodeRef root = YGNodeNewWithConfig(config); fillFuzzedTree(fdp, config, root); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeFreeRecursive(root); YGConfigFree(config); return 0; } ================================================ FILE: gentest/babel.config.cjs ================================================ /** * 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. * * @format */ module.exports = { presets: ['@babel/preset-typescript'], }; ================================================ FILE: gentest/fixtures/YGAbsolutePositionTest.html ================================================
================================================ FILE: gentest/fixtures/YGAlignContentTest.html ================================================
================================================ FILE: gentest/fixtures/YGAlignItemsTest.html ================================================
================================================ FILE: gentest/fixtures/YGAlignSelfTest.html ================================================
================================================ FILE: gentest/fixtures/YGAndroidNewsFeed.html ================================================
================================================ FILE: gentest/fixtures/YGAspectRatioTest.html ================================================
================================================ FILE: gentest/fixtures/YGAutoTest.html ================================================
================================================ FILE: gentest/fixtures/YGBorderTest.html ================================================
================================================ FILE: gentest/fixtures/YGBoxSizingTest.html ================================================
================================================ FILE: gentest/fixtures/YGDimensionTest.html ================================================
================================================ FILE: gentest/fixtures/YGDisplayTest.html ================================================
================================================ FILE: gentest/fixtures/YGFlexBasisFitContentTest.html ================================================
================================================ FILE: gentest/fixtures/YGFlexDirectionTest.html ================================================
================================================ FILE: gentest/fixtures/YGFlexTest.html ================================================
================================================ FILE: gentest/fixtures/YGFlexWrapTest.html ================================================
================================================ FILE: gentest/fixtures/YGGapTest.html ================================================
================================================ FILE: gentest/fixtures/YGIntrinsicSizeTest.html ================================================
LoremipsumdolorsitametconsecteturadipiscingelitSedeleifasdfettortoracauctorFuscerhoncusipsumtemporerosaliquamconsequatPraesentsoda
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.
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.
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.
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.
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.
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.
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.
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.
Lorem ipsum
Lorem ipsum
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.
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
Lorem ipsum dolor sit amet
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
Lorem ipsum dolor sit amet
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
Lorem ipsum dolor sit amet
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
================================================ FILE: gentest/fixtures/YGJustifyContentTest.html ================================================
================================================ FILE: gentest/fixtures/YGMarginTest.html ================================================
================================================ FILE: gentest/fixtures/YGMinMaxDimensionTest.html ================================================
================================================ FILE: gentest/fixtures/YGPaddingTest.html ================================================
================================================ FILE: gentest/fixtures/YGPercentageTest.html ================================================
================================================ FILE: gentest/fixtures/YGRoundingTest.html ================================================
================================================ FILE: gentest/fixtures/YGSizeOverflowTest.html ================================================
================================================ FILE: gentest/fixtures/YGStaticPositionTest.html ================================================
================================================ FILE: gentest/gentest-driver.ts ================================================ /** * 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. * * @format */ import * as fs from 'node:fs/promises'; import {format} from 'node:util'; import {parse, dirname} from 'path'; import * as process from 'node:process'; import {Builder, logging} from 'selenium-webdriver'; import {Options} from 'selenium-webdriver/chrome.js'; import {fileURLToPath} from 'url'; import {stdin, stdout} from 'node:process'; import minimist from 'minimist'; import readline from 'node:readline/promises'; import signedsource from 'signedsource'; function addSignatureToSourceCode(sourceCode: string): string { const codeWithToken = sourceCode.replace( 'MAGIC_PLACEHOLDER', signedsource.getSigningToken(), ); return signedsource.signFile(codeWithToken); } const argv = minimist(process.argv.slice(2)); const specificFixture = argv.f || argv.fixture; const suspend = argv.s || argv.suspend; const headless = argv.h || argv.headless; const gentestDir = dirname(fileURLToPath(import.meta.url)); const yogaDir = dirname(gentestDir); let fixtures = await fs.readdir(`${gentestDir}/fixtures`); try { if (specificFixture != null) { await fs.access(`fixtures/${specificFixture}.html`, fs.constants.F_OK); fixtures = [specificFixture + '.html']; } } catch (e) { const errorMessage = e instanceof Error ? e.message : ''; console.log( `Trying to access ${specificFixture}.html threw an exception. Executing against all fixtures. ${errorMessage}`, ); } const options = new Options(); options.addArguments( '--force-device-scale-factor=1', '--window-position=0,0', '--hide-scrollbars', ); headless && options.addArguments('--headless'); options.setLoggingPrefs({ browser: 'ALL', performance: 'ALL', }); const driver = await new Builder() .forBrowser('chrome') .setChromeOptions(options) .build(); for (const fileName of fixtures) { const fixture = await fs.readFile( `${gentestDir}/fixtures/${fileName}`, 'utf8', ); const fileNameNoExtension = parse(fileName).name; console.log('Generate', fileNameNoExtension); // TODO: replace this with something more robust than just blindly replacing // start/end in the entire fixture const ltrFixture = fixture .replaceAll('start', 'left') .replaceAll('end', 'right') .replaceAll('flex-left', 'flex-start') .replaceAll('flex-right', 'flex-end'); const rtlFixture = fixture .replaceAll('start', 'right') .replaceAll('end', 'left') .replaceAll('flex-right', 'flex-start') .replaceAll('flex-left', 'flex-end'); const template = await fs.readFile( `${gentestDir}/test-template.html`, 'utf8', ); const f = await fs.open(`${gentestDir}/test.html`, 'w'); await f.write( format(template, fileNameNoExtension, ltrFixture, rtlFixture, fixture), ); await f.close(); 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(/^[^"]*/, '')), ), ); await fs.writeFile( `${yogaDir}/java/tests/generated/com/facebook/yoga/${fileNameNoExtension}.java`, addSignatureToSourceCode( JSON.parse(testLogs[1].message.replace(/^[^"]*/, '')).replace( 'YogaTest', fileNameNoExtension, ), ), ); await fs.writeFile( `${yogaDir}/javascript/tests/generated/${fileNameNoExtension}.test.ts`, addSignatureToSourceCode( JSON.parse(testLogs[2].message.replace(/^[^"]*/, '')).replace( 'YogaTest', fileNameNoExtension, ), ), ); if (suspend) { const rl = readline.createInterface({input: stdin, output: stdout}); await rl.question(''); rl.close(); } } await fs.unlink(`${gentestDir}/test.html`); await driver.quit(); ================================================ FILE: gentest/gentest-validate.ts ================================================ /** * 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. * * @format */ 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 filesToValidate = await glob( [ 'tests/generated/**/*.{h,cpp}', 'javascript/tests/generated/**/*.test.ts', 'java/tests/generated/com/facebook/yoga/**/*.java', ], { cwd: yogaRootDir, }, ); console.log(`Found ${filesToValidate.length} files to validate`); for (const file of filesToValidate) { const content = await fs.readFile(`${yogaRootDir}/${file}`, 'utf8'); if (signedsource.isSigned(content)) { console.log(`Checking ${file}`); const validSignature = signedsource.verifySignature(content); if (!validSignature) { console.error(`Invalid signature "${file}"`); process.exitCode = 1; } } else { console.log(`Skipped ${file}`); } } ================================================ FILE: gentest/package.json ================================================ { "name": "gentest", "version": "0.0.0", "private": true, "scripts": { "gentest": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./src/cli.ts", "gentest-validate": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./scripts/gentest-validate.ts" }, "type": "module", "dependencies": { "minimist": "^1.2.8", "selenium-webdriver": "^4.16.0", "signedsource": "^2.0.0" }, "devDependencies": { "@babel/core": "^7.23.0", "@babel/preset-typescript": "^7.23.0", "@types/minimist": "^1.2.5", "@types/node": "^22.0.0", "@types/selenium-webdriver": "^4.1.21", "babel-register-esm": "^1.2.5", "glob": "^10.4.2" } } ================================================ FILE: gentest/scripts/gentest-validate.ts ================================================ /** * 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. * * @format */ 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(dirname(fileURLToPath(import.meta.url)))); const filesToValidate = await glob( [ 'tests/generated/**/*.{h,cpp}', 'javascript/tests/generated/**/*.test.ts', 'java/tests/generated/com/facebook/yoga/**/*.java', ], { cwd: yogaRootDir, }, ); console.log(`Found ${filesToValidate.length} files to validate`); for (const file of filesToValidate) { const content = await fs.readFile(`${yogaRootDir}/${file}`, 'utf8'); if (signedsource.isSigned(content)) { console.log(`Checking ${file}`); const validSignature = signedsource.verifySignature(content); if (!validSignature) { console.error(`Invalid signature "${file}"`); process.exitCode = 1; } } else { console.log(`Skipped ${file}`); } } ================================================ FILE: gentest/signedsource.d.ts ================================================ /** * 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. * * @format */ declare module 'signedsource'; ================================================ FILE: gentest/src/ChromePool.ts ================================================ /** * 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. * * @format */ import {Builder} from 'selenium-webdriver'; import {Options} from 'selenium-webdriver/chrome.js'; import type {WebDriver} from 'selenium-webdriver'; export interface ChromePool { acquire(): Promise; release(driver: WebDriver): void; shutdown(): Promise; } /** * Create a pool of headless Chrome WebDriver instances. * acquire() returns a driver when one is available; callers are * queued FIFO when all instances are busy. */ export function createChromePool(size: number): ChromePool { const available: WebDriver[] = []; const waitQueue: Array<(driver: WebDriver) => void> = []; const allDrivers: Promise[] = []; function addDriver(driver: WebDriver): void { const waiter = waitQueue.shift(); if (waiter) { waiter(driver); } else { available.push(driver); } } // Create all Chrome instances in parallel, making each available as it resolves for (let i = 0; i < size; i++) { const driverPromise = createDriver(); allDrivers.push(driverPromise); driverPromise.then(addDriver); } return { acquire(): Promise { const driver = available.pop(); if (driver) { return Promise.resolve(driver); } return new Promise(resolve => { waitQueue.push(resolve); }); }, release(driver: WebDriver): void { addDriver(driver); }, async shutdown(): Promise { const drivers = await Promise.all(allDrivers); await Promise.all(drivers.map(d => d.quit())); }, }; } function createDriver(): Promise { const options = new Options(); options.addArguments( '--force-device-scale-factor=1', '--window-position=0,0', '--hide-scrollbars', '--headless', ); return new Builder().forBrowser('chrome').setChromeOptions(options).build(); } ================================================ FILE: gentest/src/CssToYoga.ts ================================================ /** * 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. * * @format */ import type Emitter from './emitters/Emitter.ts'; import type {ParsedStyles, ValueWithUnit} from './Types.ts'; const INVISIBLE_BORDER_STYLES = new Set(['none', 'initial']); /** * Parse a raw inline style attribute string into a Map of property → value. * Expands common shorthands used in fixtures so individual longhand * properties are always present in the returned map. */ export function parseStyleAttribute(styleAttr: string): ParsedStyles { const styles: ParsedStyles = new Map(); if (!styleAttr) return styles; const declarations = styleAttr.split(';'); for (const decl of declarations) { const trimmed = decl.trim(); if (!trimmed) continue; const colonIdx = trimmed.indexOf(':'); if (colonIdx === -1) continue; const prop = trimmed.slice(0, colonIdx).trim(); let value = trimmed.slice(colonIdx + 1).trim(); // Strip single or double quotes from values (e.g., align-items: 'stretch') if ( (value.startsWith("'") && value.endsWith("'")) || (value.startsWith('"') && value.endsWith('"')) ) { value = value.slice(1, -1); } expandShorthand(styles, prop, value); } return styles; } function expandShorthand( styles: ParsedStyles, prop: string, value: string, ): void { switch (prop) { case 'flex': { // Only handle `flex: N` (single numeric value) as used in fixtures const n = parseFloat(value); if (!isNaN(n) && value.trim() === String(n)) { styles.set('flex-grow', String(n)); styles.set('flex-shrink', '1'); styles.set('flex-basis', '0%'); } else { // Pass through complex flex values as-is styles.set(prop, value); } break; } default: styles.set(prop, value); break; } } /** * Map parsed CSS properties to Yoga emitter method calls. */ export function applyStyles( emitter: Emitter, nodeName: string, styles: ParsedStyles, isRoot: boolean, ): void { // Root nodes get implicit absolute positioning from the template CSS. if (isRoot && !styles.has('position')) { emitter.setPositionType(nodeName, positionValue('absolute')); } for (const [prop, value] of styles) { switch (prop) { case 'direction': emitter.setDirection(nodeName, directionValue(value)); break; case 'position': if (value !== 'relative') { emitter.setPositionType(nodeName, positionValue(value)); } break; case 'flex-direction': if (value !== 'column') { emitter.setFlexDirection(nodeName, flexDirectionValue(value)); } break; case 'flex-wrap': if (value !== 'nowrap') { emitter.setFlexWrap(nodeName, wrapValue(value)); } break; case 'justify-content': { const mapped = justifyValue(value); if (mapped !== undefined && value !== 'flex-start') { emitter.setJustifyContent(nodeName, mapped); } break; } case 'align-content': { const mapped = alignValue(value); if (mapped !== undefined && value !== 'flex-start') { emitter.setAlignContent(nodeName, mapped); } break; } case 'align-items': { const mapped = alignValue(value); if (mapped !== undefined && value !== 'stretch') { emitter.setAlignItems(nodeName, mapped); } break; } case 'align-self': { const mapped = alignValue(value); if (mapped !== undefined) { emitter.setAlignSelf(nodeName, mapped); } break; } case 'overflow': if (value !== 'visible') { emitter.setOverflow(nodeName, overflowValue(value)); } break; case 'display': if (value !== 'flex') { emitter.setDisplay(nodeName, displayValue(value)); } break; case 'box-sizing': if (value !== 'border-box') { emitter.setBoxSizing(nodeName, boxSizingValue(value)); } break; case 'flex-grow': if (value !== '0') { emitter.setFlexGrow(nodeName, value); } break; case 'flex-shrink': if (value !== '0') { emitter.setFlexShrink(nodeName, value); } break; case 'flex-basis': { const parsed = parseCssLength(value); if (parsed != null) emitter.setFlexBasis(nodeName, parsed); break; } case 'aspect-ratio': emitter.setAspectRatio(nodeName, parseValueWithUnit(value)); break; // Dimensions case 'width': { const parsed = parseCssLength(value); if (parsed != null) emitter.setWidth(nodeName, parsed); break; } case 'height': { const parsed = parseCssLength(value); if (parsed != null) emitter.setHeight(nodeName, parsed); break; } case 'min-width': { if (value !== '0' && value !== '0px' && value !== 'auto') { const parsed = parseCssLength(value); if (parsed != null) emitter.setMinWidth(nodeName, parsed); } break; } case 'min-height': { if (value !== '0' && value !== '0px' && value !== 'auto') { const parsed = parseCssLength(value); if (parsed != null) emitter.setMinHeight(nodeName, parsed); } break; } case 'max-width': { const parsed = parseCssLength(value); if (parsed != null) emitter.setMaxWidth(nodeName, parsed); break; } case 'max-height': { const parsed = parseCssLength(value); if (parsed != null) emitter.setMaxHeight(nodeName, parsed); break; } // Insets - physical case 'left': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('left'), parsed); } break; } case 'top': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('top'), parsed); } break; } case 'right': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('right'), parsed); } break; } case 'bottom': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('bottom'), parsed); } break; } // Insets - logical case 'inset-inline-start': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('start'), parsed); } break; } case 'inset-inline-end': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('end'), parsed); } break; } case 'inset-block-start': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('top'), parsed); } break; } case 'inset-block-end': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPosition(nodeName, edgeValue('bottom'), parsed); } break; } // Box shorthands case 'margin': case 'padding': case 'border-width': { const parse = prop === 'border-width' ? parseBorderWidth : parseCssLength; const emit = (edge: string, v: ValueWithUnit) => { if (prop === 'margin') emitter.setMargin(nodeName, edge, v); else if (prop === 'padding') emitter.setPadding(nodeName, edge, v); else emitter.setBorder(nodeName, edge, v); }; const parts = value.split(/\s+/); switch (parts.length) { case 1: { const parsed = parse(parts[0]); if (parsed != null) { emit(edgeValue('all'), parsed); } break; } case 2: { const vertVal = parse(parts[0]); const horizVal = parse(parts[1]); if (vertVal != null) { emit(edgeValue('vertical'), vertVal); } if (horizVal != null) { emit(edgeValue('horizontal'), horizVal); } break; } case 3: { const topVal = parse(parts[0]); const horizVal = parse(parts[1]); const bottomVal = parse(parts[2]); if (topVal != null) { emit(edgeValue('top'), topVal); } if (horizVal != null) { emit(edgeValue('horizontal'), horizVal); } if (bottomVal != null) { emit(edgeValue('bottom'), bottomVal); } break; } case 4: { const topVal = parse(parts[0]); const rightVal = parse(parts[1]); const bottomVal = parse(parts[2]); const leftVal = parse(parts[3]); if (topVal != null) { emit(edgeValue('top'), topVal); } if (rightVal != null) { emit(edgeValue('right'), rightVal); } if (bottomVal != null) { emit(edgeValue('bottom'), bottomVal); } if (leftVal != null) { emit(edgeValue('left'), leftVal); } break; } } break; } // Gap shorthand case 'gap': { const parts = value.split(/\s+/); if (parts.length === 1) { const parsed = parseCssLength(parts[0]); if (parsed != null) { emitter.setGap(nodeName, gutterValue('all'), parsed); } } else { const rowVal = parseCssLength(parts[0]); const colVal = parseCssLength(parts[1]); if (rowVal != null) { emitter.setGap(nodeName, gutterValue('row'), rowVal); } if (colVal != null) { emitter.setGap(nodeName, gutterValue('column'), colVal); } } break; } // Margins - shorthand logical case 'margin-inline': { const parts = value.split(/\s+/); if (parts.length === 1) { const parsed = parseCssLength(parts[0]); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('horizontal'), parsed); } } else { const startVal = parseCssLength(parts[0]); const endVal = parseCssLength(parts[1]); if (startVal != null) { emitter.setMargin(nodeName, edgeValue('start'), startVal); } if (endVal != null) { emitter.setMargin(nodeName, edgeValue('end'), endVal); } } break; } case 'margin-block': { const parts = value.split(/\s+/); if (parts.length === 1) { const parsed = parseCssLength(parts[0]); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('vertical'), parsed); } } else { const topVal = parseCssLength(parts[0]); const bottomVal = parseCssLength(parts[1]); if (topVal != null) { emitter.setMargin(nodeName, edgeValue('top'), topVal); } if (bottomVal != null) { emitter.setMargin(nodeName, edgeValue('bottom'), bottomVal); } } break; } // Margins - physical case 'margin-left': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('left'), parsed); } break; } case 'margin-top': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('top'), parsed); } break; } case 'margin-right': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('right'), parsed); } break; } case 'margin-bottom': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('bottom'), parsed); } break; } // Margins - logical case 'margin-inline-start': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('start'), parsed); } break; } case 'margin-inline-end': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('end'), parsed); } break; } case 'margin-block-start': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('top'), parsed); } break; } case 'margin-block-end': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setMargin(nodeName, edgeValue('bottom'), parsed); } break; } // Padding - physical case 'padding-left': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('left'), parsed); } break; } case 'padding-top': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('top'), parsed); } break; } case 'padding-right': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('right'), parsed); } break; } case 'padding-bottom': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('bottom'), parsed); } break; } // Padding - logical case 'padding-inline-start': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('start'), parsed); } break; } case 'padding-inline-end': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('end'), parsed); } break; } case 'padding-inline': { const parts = value.split(/\s+/); if (parts.length === 1) { const parsed = parseCssLength(parts[0]); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('horizontal'), parsed); } } else { const startVal = parseCssLength(parts[0]); const endVal = parseCssLength(parts[1]); if (startVal != null) { emitter.setPadding(nodeName, edgeValue('start'), startVal); } if (endVal != null) { emitter.setPadding(nodeName, edgeValue('end'), endVal); } } break; } case 'padding-block': { const parts = value.split(/\s+/); if (parts.length === 1) { const parsed = parseCssLength(parts[0]); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('vertical'), parsed); } } else { const topVal = parseCssLength(parts[0]); const bottomVal = parseCssLength(parts[1]); if (topVal != null) { emitter.setPadding(nodeName, edgeValue('top'), topVal); } if (bottomVal != null) { emitter.setPadding(nodeName, edgeValue('bottom'), bottomVal); } } break; } case 'padding-block-start': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('top'), parsed); } break; } case 'padding-block-end': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setPadding(nodeName, edgeValue('bottom'), parsed); } break; } // Border - compound shorthands (e.g. `border: 10px solid black`) case 'border': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('all'), width); } break; } case 'border-top': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('top'), width); } break; } case 'border-right': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('right'), width); } break; } case 'border-bottom': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('bottom'), width); } break; } case 'border-left': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('left'), width); } break; } case 'border-block': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('vertical'), width); } break; } case 'border-inline': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('horizontal'), width); } break; } case 'border-block-start': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('top'), width); } break; } case 'border-block-end': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('bottom'), width); } break; } case 'border-inline-start': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('start'), width); } break; } case 'border-inline-end': { const width = extractBorderWidth(value); if (width != null) { emitter.setBorder(nodeName, edgeValue('end'), width); } break; } // Border - physical case 'border-left-width': { const borderStyle = styles.get('border-left-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('left'), parsed); } } break; } case 'border-top-width': { const borderStyle = styles.get('border-top-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('top'), parsed); } } break; } case 'border-right-width': { const borderStyle = styles.get('border-right-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('right'), parsed); } } break; } case 'border-bottom-width': { const borderStyle = styles.get('border-bottom-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('bottom'), parsed); } } break; } // Border - logical case 'border-inline-start-width': { const borderStyle = styles.get('border-inline-start-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('start'), parsed); } } break; } case 'border-inline-end-width': { const borderStyle = styles.get('border-inline-end-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('end'), parsed); } } break; } case 'border-block-start-width': { const borderStyle = styles.get('border-block-start-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('top'), parsed); } } break; } case 'border-block-end-width': { const borderStyle = styles.get('border-block-end-style'); if (!borderStyle || !INVISIBLE_BORDER_STYLES.has(borderStyle)) { const parsed = parseBorderWidth(value); if (parsed != null) { emitter.setBorder(nodeName, edgeValue('bottom'), parsed); } } break; } // Gap case 'row-gap': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setGap(nodeName, gutterValue('row'), parsed); } break; } case 'column-gap': { const parsed = parseCssLength(value); if (parsed != null) { emitter.setGap(nodeName, gutterValue('column'), parsed); } break; } } } } // Value parsers export function parseValueWithUnit(value: string): ValueWithUnit { if (value === 'auto') return {type: 'auto'}; if (value === 'undefined') return {type: 'undefined'}; if (value === 'max-content') return {type: 'max-content'}; if (value === 'fit-content') return {type: 'fit-content'}; if (value === 'stretch' || value === '-webkit-fill-available') return {type: 'stretch'}; if (value.endsWith('%')) return {type: 'percent', value: parseFloat(value)}; return {type: 'points', value: parseFloat(value)}; } /** * Parse a CSS length value, rejecting unitless non-zero numbers. * In CSS, only `0` is valid without a unit for length properties. * Invalid values (e.g. `padding-top: 10` without `px`) return null. */ export function parseCssLength(value: string): ValueWithUnit | null { if (value === 'auto') return {type: 'auto'}; if (value === 'undefined') return {type: 'undefined'}; if (value === 'max-content') return {type: 'max-content'}; if (value === 'fit-content') return {type: 'fit-content'}; if (value === 'stretch' || value === '-webkit-fill-available') return {type: 'stretch'}; if (value.endsWith('%')) return {type: 'percent', value: parseFloat(value)}; if (value.endsWith('px')) return {type: 'points', value: parseFloat(value)}; // Unitless 0 is valid const num = parseFloat(value); if (num === 0 && !isNaN(num)) return {type: 'points', value: 0}; // Unitless non-zero number is invalid CSS for length properties return null; } /** * Parse a CSS border-width value. Rejects unitless non-zero numbers * and percentage values (CSS border-width does not accept percentages). */ function parseBorderWidth(value: string): ValueWithUnit | null { const parsed = parseCssLength(value); if (parsed != null && parsed.type === 'percent') return null; return parsed; } /** * Extract the width component from a compound border shorthand value * like `10px solid black` or `solid black 5px`. Returns null if the * border style is invisible (none/initial) or no valid width is found. */ function extractBorderWidth(value: string): ValueWithUnit | null { const parts = value.split(/\s+/); const BORDER_STYLES = new Set([ 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial', ]); let widthStr: string | null = null; let styleStr: string | null = null; for (const part of parts) { if (BORDER_STYLES.has(part)) { styleStr = part; } else if (/^[\d.]/.test(part)) { widthStr = part; } // color values are ignored } if (styleStr && INVISIBLE_BORDER_STYLES.has(styleStr)) return null; if (widthStr == null) return null; return parseBorderWidth(widthStr); } // Enum value mappers function directionValue(value: string): string { const map: Record = { ltr: 'YGDirectionLTR', rtl: 'YGDirectionRTL', inherit: 'YGDirectionInherit', }; return map[value] ?? value; } function flexDirectionValue(value: string): string { const map: Record = { row: 'YGFlexDirectionRow', 'row-reverse': 'YGFlexDirectionRowReverse', column: 'YGFlexDirectionColumn', 'column-reverse': 'YGFlexDirectionColumnReverse', }; return map[value] ?? value; } function justifyValue(value: string): string | undefined { const map: Record = { center: 'YGJustifyCenter', 'space-around': 'YGJustifySpaceAround', 'space-between': 'YGJustifySpaceBetween', 'space-evenly': 'YGJustifySpaceEvenly', 'flex-start': 'YGJustifyFlexStart', 'flex-end': 'YGJustifyFlexEnd', stretch: 'YGJustifyStretch', start: 'YGJustifyStart', end: 'YGJustifyEnd', auto: 'YGJustifyAuto', }; return map[value]; } function alignValue(value: string): string | undefined { const map: Record = { auto: 'YGAlignAuto', center: 'YGAlignCenter', stretch: 'YGAlignStretch', 'flex-start': 'YGAlignFlexStart', 'flex-end': 'YGAlignFlexEnd', 'space-between': 'YGAlignSpaceBetween', 'space-around': 'YGAlignSpaceAround', 'space-evenly': 'YGAlignSpaceEvenly', baseline: 'YGAlignBaseline', start: 'YGAlignStart', end: 'YGAlignEnd', }; return map[value]; } function positionValue(value: string): string { const map: Record = { absolute: 'YGPositionTypeAbsolute', static: 'YGPositionTypeStatic', relative: 'YGPositionTypeRelative', }; return map[value] ?? 'YGPositionTypeRelative'; } function wrapValue(value: string): string { const map: Record = { wrap: 'YGWrapWrap', 'wrap-reverse': 'YGWrapWrapReverse', nowrap: 'YGWrapNoWrap', }; return map[value] ?? value; } function overflowValue(value: string): string { const map: Record = { visible: 'YGOverflowVisible', hidden: 'YGOverflowHidden', scroll: 'YGOverflowScroll', }; return map[value] ?? value; } function displayValue(value: string): string { const map: Record = { flex: 'YGDisplayFlex', none: 'YGDisplayNone', contents: 'YGDisplayContents', }; return map[value] ?? value; } function boxSizingValue(value: string): string { const map: Record = { 'border-box': 'YGBoxSizingBorderBox', 'content-box': 'YGBoxSizingContentBox', }; return map[value] ?? value; } function edgeValue(edge: string): string { const map: Record = { left: 'YGEdgeLeft', right: 'YGEdgeRight', top: 'YGEdgeTop', bottom: 'YGEdgeBottom', start: 'YGEdgeStart', end: 'YGEdgeEnd', all: 'YGEdgeAll', vertical: 'YGEdgeVertical', horizontal: 'YGEdgeHorizontal', }; return map[edge] ?? edge; } function gutterValue(gutter: string): string { const map: Record = { row: 'YGGutterRow', column: 'YGGutterColumn', all: 'YGGutterAll', }; return map[gutter] ?? gutter; } export function getFlexDirectionForMeasure(styles: ParsedStyles): string { const fd = styles.get('flex-direction'); return flexDirectionValue(fd ?? 'column'); } ================================================ FILE: gentest/src/buildLayoutTree.ts ================================================ /** * 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. * * @format */ import type {WebDriver} from 'selenium-webdriver'; import type {LayoutNode} from './Types.ts'; /** * Build the layout tree by querying the DOM via a single executeScript call. * Sets the document direction first, then walks the DOM under #container. */ export default async function buildLayoutTree( driver: WebDriver, direction: 'ltr' | 'rtl', ): Promise { const rawNodes = await driver.executeScript(` var container = document.getElementById('container'); // Save original style attributes before we modify them with direction. var originalStyles = new Map(); function saveStyles(parent) { for (var i = 0; i < parent.children.length; i++) { var child = parent.children[i]; originalStyles.set(child, child.getAttribute('style') || ''); saveStyles(child); } } saveStyles(container); // Set direction on each test case element (not on ) so that the // container stays LTR and root elements remain at (0, 0). for (var i = 0; i < container.children.length; i++) { container.children[i].style.direction = '${direction}'; } function getRoundedSize(node) { var rect = node.getBoundingClientRect(); return { width: Math.round(rect.right) - Math.round(rect.left), height: Math.round(rect.bottom) - Math.round(rect.top) }; } function walkTree(parent, parentLeft, parentTop) { var result = []; for (var i = 0; i < parent.children.length; i++) { var child = parent.children[i]; var rect = child.getBoundingClientRect(); var size = getRoundedSize(child); var left = Math.round(rect.left - parentLeft); var top = Math.round(rect.top - parentTop); var innerText = ''; if (child.children.length === 0 && child.innerText) { innerText = child.innerText; } result.push({ id: child.id || '', left: left, top: top, width: size.width, height: size.height, styleAttr: originalStyles.get(child) || '', experiments: child.dataset.experiments ? child.dataset.experiments.split(' ') : [], disabled: child.dataset.disabled === 'true', innerText: innerText, children: walkTree(child, rect.left, rect.top) }); } return result; } var containerRect = container.getBoundingClientRect(); return walkTree(container, containerRect.left, containerRect.top); `); return rawNodes as LayoutNode[]; } // Internal type for the raw JSON returned from executeScript interface RawNode { id: string; left: number; top: number; width: number; height: number; styleAttr: string; experiments: string[]; disabled: boolean; innerText: string; children: RawNode[]; } ================================================ FILE: gentest/src/cli.ts ================================================ /** * 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. * * @format */ import * as fs from 'node:fs/promises'; import {dirname, parse, relative, resolve} from 'path'; import * as process from 'node:process'; import {fileURLToPath, pathToFileURL} from 'url'; import {stdin, stdout} from 'node:process'; import {randomUUID} from 'node:crypto'; import minimist from 'minimist'; import readline from 'node:readline/promises'; import signedsource from 'signedsource'; import {glob} from 'glob'; import type {LayoutNode} from './Types.ts'; import {createChromePool} from './ChromePool.ts'; import buildLayoutTree from './buildLayoutTree.ts'; import {CppEmitter} from './emitters/CppEmitter.ts'; import {JavaEmitter} from './emitters/JavaEmitter.ts'; import {JavascriptEmitter} from './emitters/JavascriptEmitter.ts'; function addSignatureToSourceCode(sourceCode: string): string { const codeWithToken = sourceCode.replace( 'MAGIC_PLACEHOLDER', signedsource.getSigningToken(), ); return signedsource.signFile(codeWithToken); } const argv = minimist(process.argv.slice(2)); const specificFixture = argv.f || argv.fixture; const suspend = argv.s || argv.suspend; const poolSize = parseInt(argv['pool-size'] || '8', 10); const gentestDir = dirname(dirname(fileURLToPath(import.meta.url))); const yogaDir = dirname(gentestDir); const fixturesDir = `${gentestDir}/fixtures`; const fontPath = pathToFileURL( resolve(gentestDir, 'fonts/Ahem.ttf'), ).toString(); // Discover fixtures let fixtures: string[]; try { if (specificFixture != null) { const fixturePath = `${fixturesDir}/${specificFixture}.html`; await fs.access(fixturePath, fs.constants.F_OK); fixtures = [fixturePath]; } else { fixtures = await glob(`${fixturesDir}/**/*.html`); } } catch (e) { const errorMessage = e instanceof Error ? e.message : ''; console.log( `Trying to access ${specificFixture}.html threw an exception. Executing against all fixtures. ${errorMessage}`, ); fixtures = await glob(`${fixturesDir}/**/*.html`); } // Read template const template = await fs.readFile(`${gentestDir}/test-template.html`, 'utf8'); const templateWithFont = template.replace('%FONT_PATH%', fontPath); // Create Chrome pool const pool = createChromePool(poolSize); // Process all fixtures in parallel (limited by pool size) async function processFixture(fixturePath: string): Promise { // Acquire Chrome instance const driver = await pool.acquire(); const fixture = await fs.readFile(fixturePath, 'utf8'); const relativePath = relative(fixturesDir, fixturePath); const fileNameNoExtension = parse(relativePath).name; // Inject fixture into template const html = templateWithFont.replace('%FIXTURE%', fixture); // Write to temp file const tmpFile = `/tmp/gentest-${randomUUID()}.html`; await fs.writeFile(tmpFile, html); let ltrTree: LayoutNode[]; let rtlTree: LayoutNode[]; try { await driver.get('file://' + tmpFile); // Wait for @font-face fonts (Ahem) to finish loading before measuring await driver.executeAsyncScript(` var callback = arguments[arguments.length - 1]; document.fonts.ready.then(callback); `); // Build LTR layout tree ltrTree = await buildLayoutTree(driver, 'ltr'); // Build RTL layout tree (same page, just change direction) rtlTree = await buildLayoutTree(driver, 'rtl'); } finally { pool.release(driver); // Clean up temp file await fs.unlink(tmpFile).catch(() => undefined); } // Build test cases from top-level elements const testCases = ltrTree.map((ltrNode, i) => ({ name: ltrNode.id || 'INSERT_NAME_HERE', ltrLayout: ltrNode, rtlLayout: rtlTree[i], experiments: ltrNode.experiments, disabled: ltrNode.disabled, })); const cppCode = new CppEmitter().generateFixture( fileNameNoExtension, testCases, ); const javaCode = new JavaEmitter().generateFixture( fileNameNoExtension, testCases, ); const jsCode = new JavascriptEmitter().generateFixture( fileNameNoExtension, testCases, ); // Sign and write output files await Promise.all([ fs.writeFile( `${yogaDir}/tests/generated/${fileNameNoExtension}.cpp`, addSignatureToSourceCode(cppCode), ), fs.writeFile( `${yogaDir}/java/tests/generated/com/facebook/yoga/${fileNameNoExtension}.java`, addSignatureToSourceCode(javaCode), ), fs.writeFile( `${yogaDir}/javascript/tests/generated/${fileNameNoExtension}.test.ts`, addSignatureToSourceCode(jsCode), ), ]); console.log('Generated', fileNameNoExtension); if (suspend) { const rl = readline.createInterface({input: stdin, output: stdout}); await rl.question(''); rl.close(); } } try { await Promise.all(fixtures.map(f => processFixture(f))); } finally { await pool.shutdown(); } ================================================ FILE: gentest/src/emitters/CppEmitter.ts ================================================ /** * 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. * * @format */ import Emitter from './Emitter.ts'; import type {ValueWithUnit} from '../Types.ts'; function toValueCpp(value: string | number): string { const n = value.toString().replace('px', '').replace('%', ''); if (!Number.isFinite(Number(n))) { return n; } return n + (Number(n) % 1 !== 0 ? 'f' : ''); } function toFunctionNameCpp(value: ValueWithUnit): string { switch (value.type) { case 'percent': return 'Percent'; case 'auto': return 'Auto'; case 'max-content': return 'MaxContent'; case 'fit-content': return 'FitContent'; case 'stretch': return 'Stretch'; default: return ''; } } function valueWithUnitToString(value: ValueWithUnit): string { switch (value.type) { case 'points': return toValueCpp(value.value); case 'percent': return toValueCpp(value.value); case 'auto': return 'YGAuto'; case 'max-content': return 'MaxContent'; case 'fit-content': return 'FitContent'; case 'stretch': return 'Stretch'; case 'undefined': return 'YGUndefined'; } } export class CppEmitter extends Emitter { constructor() { super(' '); } emitCommentHeader(fixtureName: string): void { this.push([ '/*', ' * 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.', ' *', ' * clang-format off', ' * MAGIC_PLACEHOLDER', ' * generated by gentest/src/GentestDriver.ts from gentest/fixtures/' + fixtureName + '.html', ' */', '', ]); } emitPrologue(_fixtureName: string): void { this.push([ '#include ', '#include ', '#include "../util/TestUtil.h"', '', ]); } emitTestPrologue( name: string, experiments: string[], disabled: boolean, ): void { this.push('TEST(YogaTest, ' + name + ') {'); this.pushIndent(); if (disabled) { this.push('GTEST_SKIP();'); this.push(''); } this.push('YGConfigRef config = YGConfigNew();'); for (const experiment of experiments) { this.push( 'YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' + experiment + ', true);', ); } this.push(''); } emitTestTreePrologue(nodeName: string): void { this.push('YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);'); } emitTestEpilogue(_experiments: string[]): void { this.push(''); this.push('YGNodeFreeRecursive(root);'); this.push(''); this.push('YGConfigFree(config);'); this.popIndent(); this.push(['}', '']); } emitEpilogue(): void { // no-op for C++ } assertEQ(v0: number, v1: string): void { this.push('ASSERT_FLOAT_EQ(' + toValueCpp(v0) + ', ' + v1 + ');'); } layoutGetLeft(node: string): string { return 'YGNodeLayoutGetLeft(' + node + ')'; } layoutGetTop(node: string): string { return 'YGNodeLayoutGetTop(' + node + ')'; } layoutGetWidth(node: string): string { return 'YGNodeLayoutGetWidth(' + node + ')'; } layoutGetHeight(node: string): string { return 'YGNodeLayoutGetHeight(' + node + ')'; } insertChild(parent: string, child: string, index: number): void { this.push( 'YGNodeInsertChild(' + parent + ', ' + child + ', ' + index + ');', ); } calculateLayout( node: string, direction: string, _experiments: string[], ): void { this.push( 'YGNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + direction + ');', ); } setMeasureFunc(node: string, text: string, _flexDirection: string): void { this.push(`YGNodeSetContext(${node}, (void*)"${text}");`); this.push( `YGNodeSetMeasureFunc(${node}, &facebook::yoga::test::IntrinsicSizeMeasure);`, ); } setDirection(node: string, value: string): void { this.push( 'YGNodeStyleSetDirection(' + node + ', ' + toValueCpp(value) + ');', ); } setFlexDirection(node: string, value: string): void { this.push( 'YGNodeStyleSetFlexDirection(' + node + ', ' + toValueCpp(value) + ');', ); } setJustifyContent(node: string, value: string): void { this.push( 'YGNodeStyleSetJustifyContent(' + node + ', ' + toValueCpp(value) + ');', ); } setAlignContent(node: string, value: string): void { this.push( 'YGNodeStyleSetAlignContent(' + node + ', ' + toValueCpp(value) + ');', ); } setAlignItems(node: string, value: string): void { this.push( 'YGNodeStyleSetAlignItems(' + node + ', ' + toValueCpp(value) + ');', ); } setAlignSelf(node: string, value: string): void { this.push( 'YGNodeStyleSetAlignSelf(' + node + ', ' + toValueCpp(value) + ');', ); } setPositionType(node: string, value: string): void { this.push( 'YGNodeStyleSetPositionType(' + node + ', ' + toValueCpp(value) + ');', ); } setFlexWrap(node: string, value: string): void { this.push( 'YGNodeStyleSetFlexWrap(' + node + ', ' + toValueCpp(value) + ');', ); } setOverflow(node: string, value: string): void { this.push( 'YGNodeStyleSetOverflow(' + node + ', ' + toValueCpp(value) + ');', ); } setDisplay(node: string, value: string): void { this.push( 'YGNodeStyleSetDisplay(' + node + ', ' + toValueCpp(value) + ');', ); } setBoxSizing(node: string, value: string): void { this.push( 'YGNodeStyleSetBoxSizing(' + node + ', ' + toValueCpp(value) + ');', ); } setFlexGrow(node: string, value: string): void { this.push( 'YGNodeStyleSetFlexGrow(' + node + ', ' + toValueCpp(value) + ');', ); } setFlexShrink(node: string, value: string): void { this.push( 'YGNodeStyleSetFlexShrink(' + node + ', ' + toValueCpp(value) + ');', ); } setFlexBasis(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetFlexBasis' + suffix + '(' + node + ');'); } else { this.push( 'YGNodeStyleSetFlexBasis' + suffix + '(' + node + ', ' + v + ');', ); } } setWidth(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetWidth' + suffix + '(' + node + ');'); } else { this.push('YGNodeStyleSetWidth' + suffix + '(' + node + ', ' + v + ');'); } } setHeight(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetHeight' + suffix + '(' + node + ');'); } else { this.push('YGNodeStyleSetHeight' + suffix + '(' + node + ', ' + v + ');'); } } setMinWidth(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetMinWidth' + suffix + '(' + node + ');'); } else { this.push( 'YGNodeStyleSetMinWidth' + suffix + '(' + node + ', ' + v + ');', ); } } setMinHeight(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetMinHeight' + suffix + '(' + node + ');'); } else { this.push( 'YGNodeStyleSetMinHeight' + suffix + '(' + node + ', ' + v + ');', ); } } setMaxWidth(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetMaxWidth' + suffix + '(' + node + ');'); } else { this.push( 'YGNodeStyleSetMaxWidth' + suffix + '(' + node + ', ' + v + ');', ); } } setMaxHeight(node: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push('YGNodeStyleSetMaxHeight' + suffix + '(' + node + ');'); } else { this.push( 'YGNodeStyleSetMaxHeight' + suffix + '(' + node + ', ' + v + ');', ); } } setMargin(node: string, edge: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if (suffix === 'Auto') { this.push('YGNodeStyleSetMarginAuto(' + node + ', ' + edge + ');'); } else { this.push( 'YGNodeStyleSetMargin' + suffix + '(' + node + ', ' + edge + ', ' + v + ');', ); } } setPadding(node: string, edge: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); this.push( 'YGNodeStyleSetPadding' + suffix + '(' + node + ', ' + edge + ', ' + v + ');', ); } setPosition(node: string, edge: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); if (suffix === 'Auto') { this.push('YGNodeStyleSetPositionAuto(' + node + ', ' + edge + ');'); } else { this.push( 'YGNodeStyleSetPosition' + suffix + '(' + node + ', ' + edge + ', ' + v + ');', ); } } setBorder(node: string, edge: string, value: ValueWithUnit): void { const v = valueWithUnitToString(value); this.push('YGNodeStyleSetBorder(' + node + ', ' + edge + ', ' + v + ');'); } setGap(node: string, gutter: string, value: ValueWithUnit): void { const suffix = toFunctionNameCpp(value); const v = valueWithUnitToString(value); this.push( 'YGNodeStyleSetGap' + suffix + '(' + node + ', ' + gutter + ', ' + v + ');', ); } setAspectRatio(node: string, value: ValueWithUnit): void { const v = valueWithUnitToString(value); this.push('YGNodeStyleSetAspectRatio(' + node + ', ' + v + ');'); } } ================================================ FILE: gentest/src/emitters/Emitter.ts ================================================ /** * 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. * * @format */ import type {ValueWithUnit, LayoutNode} from '../Types.ts'; import { parseStyleAttribute, applyStyles, getFlexDirectionForMeasure, } from '../CssToYoga.ts'; interface TestCase { name: string; ltrLayout: LayoutNode; rtlLayout: LayoutNode; experiments: string[]; disabled: boolean; } /** * Abstract base class for language-specific test code emitters. * Accumulates lines of output with indentation management. */ export default abstract class Emitter { protected lines: string[] = []; protected indents: string[] = []; protected indent: string; constructor(indent: string) { this.indent = indent; } push(line: string | string[]): void { if (Array.isArray(line)) { for (const l of line) { this.push(l); } return; } if (line.length > 0) { line = this.indents.join('') + line; } this.lines.push(line); } pushIndent(): void { this.indents.push(this.indent); } popIndent(): void { this.indents.pop(); } getOutput(): string { return this.lines.join('\n'); } // Comment header abstract emitCommentHeader(fixtureName: string): void; // Lifecycle abstract emitPrologue(fixtureName: string): void; abstract emitEpilogue(): void; abstract emitTestPrologue( name: string, experiments: string[], disabled: boolean, ): void; abstract emitTestEpilogue(experiments: string[]): void; abstract emitTestTreePrologue(nodeName: string): void; // Node operations abstract insertChild(parent: string, child: string, index: number): void; abstract calculateLayout( node: string, direction: string, experiments: string[], ): void; abstract setMeasureFunc( node: string, text: string, flexDirection: string, ): void; // Assertions abstract assertEQ(expected: number, actual: string): void; abstract layoutGetLeft(node: string): string; abstract layoutGetTop(node: string): string; abstract layoutGetWidth(node: string): string; abstract layoutGetHeight(node: string): string; // Style setters abstract setDirection(node: string, value: string): void; abstract setFlexDirection(node: string, value: string): void; abstract setJustifyContent(node: string, value: string): void; abstract setAlignContent(node: string, value: string): void; abstract setAlignItems(node: string, value: string): void; abstract setAlignSelf(node: string, value: string): void; abstract setPositionType(node: string, value: string): void; abstract setFlexWrap(node: string, value: string): void; abstract setOverflow(node: string, value: string): void; abstract setDisplay(node: string, value: string): void; abstract setBoxSizing(node: string, value: string): void; abstract setFlexGrow(node: string, value: string): void; abstract setFlexShrink(node: string, value: string): void; abstract setFlexBasis(node: string, value: ValueWithUnit): void; abstract setWidth(node: string, value: ValueWithUnit): void; abstract setHeight(node: string, value: ValueWithUnit): void; abstract setMinWidth(node: string, value: ValueWithUnit): void; abstract setMinHeight(node: string, value: ValueWithUnit): void; abstract setMaxWidth(node: string, value: ValueWithUnit): void; abstract setMaxHeight(node: string, value: ValueWithUnit): void; abstract setMargin(node: string, edge: string, value: ValueWithUnit): void; abstract setPadding(node: string, edge: string, value: ValueWithUnit): void; abstract setPosition(node: string, edge: string, value: ValueWithUnit): void; abstract setBorder(node: string, edge: string, value: ValueWithUnit): void; abstract setGap(node: string, gutter: string, value: ValueWithUnit): void; abstract setAspectRatio(node: string, value: ValueWithUnit): void; /** * Generate test code for a complete fixture. */ generateFixture(fixtureName: string, testCases: TestCase[]): string { this.emitCommentHeader(fixtureName); this.emitPrologue(fixtureName); for (const testCase of testCases) { const ltrTree = testCase.ltrLayout; const rtlTree = testCase.rtlLayout; this.emitTestPrologue( testCase.name, testCase.experiments, testCase.disabled, ); this.setupTestTree(ltrTree, 'root', null, undefined); this.calculateLayout('root', 'YGDirectionLTR', testCase.experiments); this.push(''); this.assertTestTree(ltrTree, 'root'); this.push(''); this.calculateLayout('root', 'YGDirectionRTL', testCase.experiments); this.push(''); this.assertTestTree(rtlTree, 'root'); this.emitTestEpilogue(testCase.experiments); } this.emitEpilogue(); return this.getOutput(); } private setupTestTree( node: LayoutNode, nodeName: string, parentName: string | null, index: number | undefined, ): void { this.emitTestTreePrologue(nodeName); const styles = parseStyleAttribute(node.styleAttr); const isRoot = parentName === null; applyStyles(this, nodeName, styles, isRoot); if (parentName !== null && index !== undefined) { this.insertChild(parentName, nodeName, index); } if (node.innerText && node.children.length === 0) { const flexDirection = getFlexDirectionForMeasure(styles); this.setMeasureFunc(nodeName, node.innerText, flexDirection); } for (let i = 0; i < node.children.length; i++) { this.push(''); const childName = nodeName + '_child' + i; this.setupTestTree(node.children[i], childName, nodeName, i); } } private assertTestTree(node: LayoutNode, nodeName: string): void { this.assertEQ(node.left, this.layoutGetLeft(nodeName)); this.assertEQ(node.top, this.layoutGetTop(nodeName)); this.assertEQ(node.width, this.layoutGetWidth(nodeName)); this.assertEQ(node.height, this.layoutGetHeight(nodeName)); for (let i = 0; i < node.children.length; i++) { this.push(''); const childName = nodeName + '_child' + i; this.assertTestTree(node.children[i], childName); } } } ================================================ FILE: gentest/src/emitters/JavaEmitter.ts ================================================ /** * 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. * * @format */ import Emitter from './Emitter.ts'; import type {ValueWithUnit} from '../Types.ts'; function toValueJava(value: string | number): string { const n = value.toString().replace('px', '').replace('%', ''); return n; } function toMethodName(value: ValueWithUnit): string { switch (value.type) { case 'percent': return 'Percent'; case 'auto': return 'Auto'; case 'max-content': return 'MaxContent'; case 'fit-content': return 'FitContent'; case 'stretch': return 'Stretch'; default: return ''; } } function valueWithUnitToString(value: ValueWithUnit): string { switch (value.type) { case 'points': return toValueJava(value.value); case 'percent': return toValueJava(value.value); case 'auto': return 'YogaConstants.AUTO'; case 'max-content': return 'MAX_CONTENT'; case 'fit-content': return 'FIT_CONTENT'; case 'stretch': return 'STRETCH'; case 'undefined': return 'YogaConstants.UNDEFINED'; } } function toJavaUpper(symbol: string): string { let out = ''; for (let i = 0; i < symbol.length; i++) { const c = symbol[i]; if ( c === c.toUpperCase() && i !== 0 && symbol[i - 1] !== symbol[i - 1].toUpperCase() ) { out += '_'; } out += c.toUpperCase(); } return out; } export class JavaEmitter extends Emitter { private static enumMap: Record = { YGAlignAuto: 'YogaAlign.AUTO', YGAlignCenter: 'YogaAlign.CENTER', YGAlignFlexEnd: 'YogaAlign.FLEX_END', YGAlignFlexStart: 'YogaAlign.FLEX_START', YGAlignStretch: 'YogaAlign.STRETCH', YGAlignSpaceBetween: 'YogaAlign.SPACE_BETWEEN', YGAlignSpaceAround: 'YogaAlign.SPACE_AROUND', YGAlignSpaceEvenly: 'YogaAlign.SPACE_EVENLY', YGAlignBaseline: 'YogaAlign.BASELINE', YGDirectionInherit: 'YogaDirection.INHERIT', YGDirectionLTR: 'YogaDirection.LTR', YGDirectionRTL: 'YogaDirection.RTL', YGEdgeBottom: 'YogaEdge.BOTTOM', YGEdgeEnd: 'YogaEdge.END', YGEdgeLeft: 'YogaEdge.LEFT', YGEdgeRight: 'YogaEdge.RIGHT', YGEdgeStart: 'YogaEdge.START', YGEdgeTop: 'YogaEdge.TOP', YGEdgeAll: 'YogaEdge.ALL', YGEdgeVertical: 'YogaEdge.VERTICAL', YGEdgeHorizontal: 'YogaEdge.HORIZONTAL', YGGutterAll: 'YogaGutter.ALL', YGGutterColumn: 'YogaGutter.COLUMN', YGGutterRow: 'YogaGutter.ROW', YGFlexDirectionColumn: 'YogaFlexDirection.COLUMN', YGFlexDirectionColumnReverse: 'YogaFlexDirection.COLUMN_REVERSE', YGFlexDirectionRow: 'YogaFlexDirection.ROW', YGFlexDirectionRowReverse: 'YogaFlexDirection.ROW_REVERSE', YGJustifyCenter: 'YogaJustify.CENTER', YGJustifyFlexEnd: 'YogaJustify.FLEX_END', YGJustifyFlexStart: 'YogaJustify.FLEX_START', YGJustifySpaceAround: 'YogaJustify.SPACE_AROUND', YGJustifySpaceBetween: 'YogaJustify.SPACE_BETWEEN', YGJustifySpaceEvenly: 'YogaJustify.SPACE_EVENLY', YGOverflowHidden: 'YogaOverflow.HIDDEN', YGOverflowVisible: 'YogaOverflow.VISIBLE', YGOverflowScroll: 'YogaOverflow.SCROLL', YGPositionTypeAbsolute: 'YogaPositionType.ABSOLUTE', YGPositionTypeRelative: 'YogaPositionType.RELATIVE', YGPositionTypeStatic: 'YogaPositionType.STATIC', YGWrapNoWrap: 'YogaWrap.NO_WRAP', YGWrapWrap: 'YogaWrap.WRAP', YGWrapWrapReverse: 'YogaWrap.WRAP_REVERSE', YGDisplayFlex: 'YogaDisplay.FLEX', YGDisplayNone: 'YogaDisplay.NONE', YGDisplayContents: 'YogaDisplay.CONTENTS', YGBoxSizingBorderBox: 'YogaBoxSizing.BORDER_BOX', YGBoxSizingContentBox: 'YogaBoxSizing.CONTENT_BOX', }; private tr(value: string): string { return JavaEmitter.enumMap[value] ?? value; } constructor() { super(' '); } emitCommentHeader(fixtureName: string): void { this.push([ '/*', ' * 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.', ' *', ' * MAGIC_PLACEHOLDER', ' * generated by gentest/src/GentestDriver.ts from gentest/fixtures/' + fixtureName + '.html', ' */', '', ]); } emitPrologue(fixtureName: string): void { this.push([ '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 ' + fixtureName + ' {', ]); this.pushIndent(); this.push([ '@Parameterized.Parameters(name = "{0}")', 'public static Iterable nodeFactories() {', ]); this.pushIndent(); this.push('return TestParametrization.nodeFactories();'); this.popIndent(); this.push('}'); this.push([ '', '@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;', '', ]); } emitTestPrologue( name: string, experiments: string[], disabled: boolean, ): void { this.push('@Test'); if (disabled) { this.push('@Ignore'); } this.push('public void test_' + name + '() {'); this.pushIndent(); this.push('YogaConfig config = YogaConfigFactory.create();'); for (const experiment of experiments) { this.push( 'config.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiment) + ', true);', ); } this.push(''); } emitTestTreePrologue(nodeName: string): void { this.push('final YogaNode ' + nodeName + ' = createNode(config);'); } emitTestEpilogue(_experiments: string[]): void { this.popIndent(); this.push(['}', '']); } emitEpilogue(): void { this.push('private YogaNode createNode(YogaConfig config) {'); this.pushIndent(); this.push('return mNodeFactory.create(config);'); this.popIndent(); this.push('}'); this.popIndent(); this.push(['}', '']); } assertEQ(v0: number, v1: string): void { this.push('assertEquals(' + v0 + 'f, ' + v1 + ', 0.0f);'); } layoutGetLeft(node: string): string { return node + '.getLayoutX()'; } layoutGetTop(node: string): string { return node + '.getLayoutY()'; } layoutGetWidth(node: string): string { return node + '.getLayoutWidth()'; } layoutGetHeight(node: string): string { return node + '.getLayoutHeight()'; } insertChild(parent: string, child: string, index: number): void { this.push(parent + '.addChildAt(' + child + ', ' + index + ');'); } calculateLayout( node: string, direction: string, _experiments: string[], ): void { this.push(node + '.setDirection(' + this.tr(direction) + ');'); this.push( node + '.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);', ); } setMeasureFunc(node: string, text: string, _flexDirection: string): void { this.push(`${node}.setData("${text}");`); this.push( `${node}.setMeasureFunction(new TestUtils.intrinsicMeasureFunction());`, ); } setDirection(node: string, value: string): void { this.push(node + '.setDirection(' + this.tr(value) + ');'); } setFlexDirection(node: string, value: string): void { this.push(node + '.setFlexDirection(' + this.tr(value) + ');'); } setJustifyContent(node: string, value: string): void { this.push(node + '.setJustifyContent(' + this.tr(value) + ');'); } setAlignContent(node: string, value: string): void { this.push(node + '.setAlignContent(' + this.tr(value) + ');'); } setAlignItems(node: string, value: string): void { this.push(node + '.setAlignItems(' + this.tr(value) + ');'); } setAlignSelf(node: string, value: string): void { this.push(node + '.setAlignSelf(' + this.tr(value) + ');'); } setPositionType(node: string, value: string): void { this.push(node + '.setPositionType(' + this.tr(value) + ');'); } setFlexWrap(node: string, value: string): void { this.push(node + '.setWrap(' + this.tr(value) + ');'); } setOverflow(node: string, value: string): void { this.push(node + '.setOverflow(' + this.tr(value) + ');'); } setDisplay(node: string, value: string): void { this.push(node + '.setDisplay(' + this.tr(value) + ');'); } setBoxSizing(node: string, value: string): void { this.push(node + '.setBoxSizing(' + this.tr(value) + ');'); } setFlexGrow(node: string, value: string): void { this.push(node + '.setFlexGrow(' + value + 'f);'); } setFlexShrink(node: string, value: string): void { this.push(node + '.setFlexShrink(' + value + 'f);'); } setFlexBasis(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setFlexBasis' + suffix + '();'); } else { this.push(node + '.setFlexBasis' + suffix + '(' + v + 'f);'); } } setWidth(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setWidth' + suffix + '();'); } else { this.push(node + '.setWidth' + suffix + '(' + v + 'f);'); } } setHeight(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setHeight' + suffix + '();'); } else { this.push(node + '.setHeight' + suffix + '(' + v + 'f);'); } } setMinWidth(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setMinWidth' + suffix + '();'); } else { this.push(node + '.setMinWidth' + suffix + '(' + v + 'f);'); } } setMinHeight(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setMinHeight' + suffix + '();'); } else { this.push(node + '.setMinHeight' + suffix + '(' + v + 'f);'); } } setMaxWidth(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setMaxWidth' + suffix + '();'); } else { this.push(node + '.setMaxWidth' + suffix + '(' + v + 'f);'); } } setMaxHeight(node: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if ( suffix === 'Auto' || suffix === 'MaxContent' || suffix === 'FitContent' || suffix === 'Stretch' ) { this.push(node + '.setMaxHeight' + suffix + '();'); } else { this.push(node + '.setMaxHeight' + suffix + '(' + v + 'f);'); } } setMargin(node: string, edge: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if (suffix === 'Auto') { this.push(node + '.setMarginAuto(' + this.tr(edge) + ');'); } else { this.push( node + '.setMargin' + suffix + '(' + this.tr(edge) + ', ' + v + 'f);', ); } } setPadding(node: string, edge: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); this.push( node + '.setPadding' + suffix + '(' + this.tr(edge) + ', ' + v + ');', ); } setPosition(node: string, edge: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); if (suffix === 'Auto') { this.push(node + '.setPositionAuto(' + this.tr(edge) + ');'); } else { this.push( node + '.setPosition' + suffix + '(' + this.tr(edge) + ', ' + v + 'f);', ); } } setBorder(node: string, edge: string, value: ValueWithUnit): void { const v = valueWithUnitToString(value); this.push(node + '.setBorder(' + this.tr(edge) + ', ' + v + 'f);'); } setGap(node: string, gutter: string, value: ValueWithUnit): void { const suffix = toMethodName(value); const v = valueWithUnitToString(value); this.push( node + '.setGap' + suffix + '(' + this.tr(gutter) + ', ' + v + 'f);', ); } setAspectRatio(node: string, value: ValueWithUnit): void { const v = valueWithUnitToString(value); this.push(node + '.setAspectRatio(' + v + 'f);'); } } ================================================ FILE: gentest/src/emitters/JavascriptEmitter.ts ================================================ /** * 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. * * @format */ import Emitter from './Emitter.ts'; import type {ValueWithUnit} from '../Types.ts'; function toValueJavascript(value: ValueWithUnit): string { switch (value.type) { case 'points': return String(value.value); case 'percent': return JSON.stringify(value.value + '%'); case 'auto': return '"auto"'; case 'max-content': return '"max-content"'; case 'fit-content': return '"fit-content"'; case 'stretch': return '"stretch"'; case 'undefined': return 'undefined'; } } export class JavascriptEmitter extends Emitter { private static enumMap: Record = { YGAlignAuto: 'Align.Auto', YGAlignCenter: 'Align.Center', YGAlignFlexEnd: 'Align.FlexEnd', YGAlignFlexStart: 'Align.FlexStart', YGAlignStretch: 'Align.Stretch', YGAlignSpaceBetween: 'Align.SpaceBetween', YGAlignSpaceAround: 'Align.SpaceAround', YGAlignSpaceEvenly: 'Align.SpaceEvenly', YGAlignBaseline: 'Align.Baseline', YGDirectionInherit: 'Direction.Inherit', YGDirectionLTR: 'Direction.LTR', YGDirectionRTL: 'Direction.RTL', YGEdgeBottom: 'Edge.Bottom', YGEdgeEnd: 'Edge.End', YGEdgeLeft: 'Edge.Left', YGEdgeRight: 'Edge.Right', YGEdgeStart: 'Edge.Start', YGEdgeTop: 'Edge.Top', YGEdgeAll: 'Edge.All', YGEdgeVertical: 'Edge.Vertical', YGEdgeHorizontal: 'Edge.Horizontal', YGGutterAll: 'Gutter.All', YGGutterColumn: 'Gutter.Column', YGGutterRow: 'Gutter.Row', YGFlexDirectionColumn: 'FlexDirection.Column', YGFlexDirectionColumnReverse: 'FlexDirection.ColumnReverse', YGFlexDirectionRow: 'FlexDirection.Row', YGFlexDirectionRowReverse: 'FlexDirection.RowReverse', YGJustifyCenter: 'Justify.Center', YGJustifyFlexEnd: 'Justify.FlexEnd', YGJustifyFlexStart: 'Justify.FlexStart', YGJustifySpaceAround: 'Justify.SpaceAround', YGJustifySpaceBetween: 'Justify.SpaceBetween', YGJustifySpaceEvenly: 'Justify.SpaceEvenly', YGOverflowHidden: 'Overflow.Hidden', YGOverflowVisible: 'Overflow.Visible', YGOverflowScroll: 'Overflow.Scroll', YGPositionTypeAbsolute: 'PositionType.Absolute', YGPositionTypeRelative: 'PositionType.Relative', YGPositionTypeStatic: 'PositionType.Static', YGWrapNoWrap: 'Wrap.NoWrap', YGWrapWrap: 'Wrap.Wrap', YGWrapWrapReverse: 'Wrap.WrapReverse', YGDisplayFlex: 'Display.Flex', YGDisplayNone: 'Display.None', YGDisplayContents: 'Display.Contents', YGBoxSizingBorderBox: 'BoxSizing.BorderBox', YGBoxSizingContentBox: 'BoxSizing.ContentBox', }; private tr(value: string): string { return JavascriptEmitter.enumMap[value] ?? value; } constructor() { super(' '); } emitCommentHeader(fixtureName: string): void { this.push([ '/**', ' * 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.', ' *', ' * MAGIC_PLACEHOLDER', ' * generated by gentest/src/GentestDriver.ts from gentest/fixtures/' + fixtureName + '.html', ' */', '', ]); } emitPrologue(_fixtureName: string): void { 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,'); this.push('Errata,'); this.push('ExperimentalFeature,'); this.push('FlexDirection,'); this.push('Gutter,'); this.push('Justify,'); this.push('MeasureMode,'); this.push('Overflow,'); this.push('PositionType,'); this.push('Unit,'); this.push('Wrap,'); this.popIndent(); this.push("} from 'yoga-layout';"); this.push(''); } emitTestPrologue( name: string, experiments: string[], disabled: boolean, ): void { const testFn = disabled ? 'test.skip' : 'test'; this.push(`${testFn}('${name}', () => {`); this.pushIndent(); this.push('const config = Yoga.Config.create();'); this.push(''); if (experiments.length > 0) { for (const experiment of experiments) { this.push( `config.setExperimentalFeatureEnabled(ExperimentalFeature.${experiment}, true);`, ); } this.push(''); } } emitTestTreePrologue(nodeName: string): void { if (nodeName === 'root') { this.push('const root = Yoga.Node.create(config);'); } else { this.push(`const ${nodeName} = Yoga.Node.create(config);`); } } emitTestEpilogue(_experiments: string[]): void { this.popIndent(); this.push('});'); } emitEpilogue(): void { this.push(''); } assertEQ(v0: number, v1: string): void { this.push(`expect(${v1}).toBe(${v0});`); } layoutGetLeft(node: string): string { return node + '.getComputedLeft()'; } layoutGetTop(node: string): string { return node + '.getComputedTop()'; } layoutGetWidth(node: string): string { return node + '.getComputedWidth()'; } layoutGetHeight(node: string): string { return node + '.getComputedHeight()'; } insertChild(parent: string, child: string, index: number): void { this.push(parent + '.insertChild(' + child + ', ' + index + ');'); } calculateLayout( node: string, direction: string, _experiments: string[], ): void { this.push( node + '.calculateLayout(undefined, undefined, ' + this.tr(direction) + ');', ); } setMeasureFunc(node: string, text: string, flexDirection: string): void { this.push( `${node}.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "${text}", flexDirection: ${this.tr( flexDirection, )}}));`, ); } setDirection(node: string, value: string): void { this.push(node + '.setDirection(' + this.tr(value) + ');'); } setFlexDirection(node: string, value: string): void { this.push(node + '.setFlexDirection(' + this.tr(value) + ');'); } setJustifyContent(node: string, value: string): void { this.push(node + '.setJustifyContent(' + this.tr(value) + ');'); } setAlignContent(node: string, value: string): void { this.push(node + '.setAlignContent(' + this.tr(value) + ');'); } setAlignItems(node: string, value: string): void { this.push(node + '.setAlignItems(' + this.tr(value) + ');'); } setAlignSelf(node: string, value: string): void { this.push(node + '.setAlignSelf(' + this.tr(value) + ');'); } setPositionType(node: string, value: string): void { this.push(node + '.setPositionType(' + this.tr(value) + ');'); } setFlexWrap(node: string, value: string): void { this.push(node + '.setFlexWrap(' + this.tr(value) + ');'); } setOverflow(node: string, value: string): void { this.push(node + '.setOverflow(' + this.tr(value) + ');'); } setDisplay(node: string, value: string): void { this.push(node + '.setDisplay(' + this.tr(value) + ');'); } setBoxSizing(node: string, value: string): void { this.push(node + '.setBoxSizing(' + this.tr(value) + ');'); } setFlexGrow(node: string, value: string): void { this.push(node + '.setFlexGrow(' + value + ');'); } setFlexShrink(node: string, value: string): void { this.push(node + '.setFlexShrink(' + value + ');'); } setFlexBasis(node: string, value: ValueWithUnit): void { this.push(node + '.setFlexBasis(' + toValueJavascript(value) + ');'); } setWidth(node: string, value: ValueWithUnit): void { this.push(node + '.setWidth(' + toValueJavascript(value) + ');'); } setHeight(node: string, value: ValueWithUnit): void { this.push(node + '.setHeight(' + toValueJavascript(value) + ');'); } setMinWidth(node: string, value: ValueWithUnit): void { this.push(node + '.setMinWidth(' + toValueJavascript(value) + ');'); } setMinHeight(node: string, value: ValueWithUnit): void { this.push(node + '.setMinHeight(' + toValueJavascript(value) + ');'); } setMaxWidth(node: string, value: ValueWithUnit): void { this.push(node + '.setMaxWidth(' + toValueJavascript(value) + ');'); } setMaxHeight(node: string, value: ValueWithUnit): void { this.push(node + '.setMaxHeight(' + toValueJavascript(value) + ');'); } setMargin(node: string, edge: string, value: ValueWithUnit): void { this.push( node + '.setMargin(' + this.tr(edge) + ', ' + toValueJavascript(value) + ');', ); } setPadding(node: string, edge: string, value: ValueWithUnit): void { this.push( node + '.setPadding(' + this.tr(edge) + ', ' + toValueJavascript(value) + ');', ); } setPosition(node: string, edge: string, value: ValueWithUnit): void { const v = toValueJavascript(value); if (v === '"auto"') { this.push(node + '.setPositionAuto(' + this.tr(edge) + ');'); } else { this.push(node + '.setPosition(' + this.tr(edge) + ', ' + v + ');'); } } setBorder(node: string, edge: string, value: ValueWithUnit): void { this.push( node + '.setBorder(' + this.tr(edge) + ', ' + toValueJavascript(value) + ');', ); } setGap(node: string, gutter: string, value: ValueWithUnit): void { this.push( node + '.setGap(' + this.tr(gutter) + ', ' + toValueJavascript(value) + ');', ); } setAspectRatio(node: string, value: ValueWithUnit): void { this.push(node + '.setAspectRatio(' + toValueJavascript(value) + ');'); } } ================================================ FILE: gentest/src/types.ts ================================================ /** * 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. * * @format */ export type ValueWithUnit = | {type: 'points'; value: number} | {type: 'percent'; value: number} | {type: 'auto'} | {type: 'max-content'} | {type: 'fit-content'} | {type: 'stretch'} | {type: 'undefined'}; export type ParsedStyles = Map; export interface LayoutNode { id: string; left: number; top: number; width: number; height: number; styleAttr: string; experiments: string[]; disabled: boolean; innerText: string; children: LayoutNode[]; } export interface TestCase { name: string; ltrLayout: LayoutNode; rtlLayout: LayoutNode; styleAttr: string; experiments: string[]; disabled: boolean; } ================================================ FILE: gentest/test-template.html ================================================
%FIXTURE%
================================================ FILE: gentest/tsconfig.json ================================================ { "compilerOptions": { "allowImportingTsExtensions": true, "esModuleInterop": true, "lib": ["es2023"], "moduleResolution": "nodenext", "module": "nodenext", "noEmit": true, "skipLibCheck": true, "strict": true, "target": "es2022" } } ================================================ FILE: gradle/wrapper/gradle-wrapper.properties ================================================ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists ================================================ FILE: gradle.properties ================================================ # # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the LICENSE # file in the root directory of this source tree. # # Project-wide Gradle settings. android.useAndroidX=true org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8 VERSION_NAME=0.0.0 ================================================ FILE: gradlew ================================================ #!/bin/sh # # Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 # ############################################################################## # # Gradle start up script for POSIX generated by Gradle. # # Important for running: # # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is # noncompliant, but you have some other compliant shell such as ksh or # bash, then to run this script, type that shell name before the whole # command line, like: # # ksh Gradle # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # «${var#prefix}», «${var%suffix}», and «$( cmd )»; # * compound commands having a testable exit status, especially «case»; # * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # # (2) This script targets any POSIX shell, so it avoids extensions provided # by Bash, Ksh, etc; in particular arrays are avoided. # # The "traditional" practice of packing multiple parameters into a # space-separated string is a well documented source of bugs and security # problems, so this is (mostly) avoided, by progressively accumulating # options in "$@", and eventually passing that to Java. # # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; # see the in-line comments for details. # # There are tweaks for specific operating systems such as AIX, CygWin, # 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 # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. # ############################################################################## # Attempt to set APP_HOME # Resolve links: $0 may be a link app_path=$0 # Need this for daisy-chained symlinks. while APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path [ -h "$app_path" ] do ls=$( ls -ld "$app_path" ) link=${ls#*' -> '} case $link in #( /*) app_path=$link ;; #( *) app_path=$APP_HOME$link ;; esac 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 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { echo "$*" } >&2 die () { echo echo "$*" echo exit 1 } >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false case "$( uname )" in #( CYGWIN* ) cygwin=true ;; #( Darwin* ) darwin=true ;; #( MSYS* | MINGW* ) msys=true ;; #( NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD=$JAVA_HOME/jre/sh/java else JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the 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. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi # Collect all arguments for the java command, stacking in reverse order: # * args from the command line # * the main class name # * -classpath # * -D...appname settings # * --module-path (only if needed) # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) # Now convert the arguments - kludge to limit ourselves to /bin/sh for arg do if case $arg in #( -*) false ;; # don't mess with options #( /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath [ -e "$t" ] ;; #( *) false ;; esac then arg=$( cygpath --path --ignore --mixed "$arg" ) fi # Roll the args list around exactly as many times as the number of # args, so each arg winds up back in the position where it started, but # possibly modified. # # NB: a `for` loop captures its iteration list before it begins, so # changing the positional parameters here affects neither the number of # iterations, nor the values presented in `arg`. shift # remove old arg set -- "$@" "$arg" # push replacement arg done 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. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ org.gradle.wrapper.GradleWrapperMain \ "$@" # Stop when "xargs" is not available. if ! command -v xargs >/dev/null 2>&1 then die "xargs is not available" fi # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. # # In Bash we could simply go: # # readarray ARGS < <( xargs -n1 <<<"$var" ) && # set -- "${ARGS[@]}" "$@" # # but POSIX shell has neither arrays nor command substitution, so instead we # post-process each arg (as a line of input to sed) to backslash-escape any # character that might be a shell metacharacter, then use eval to reverse # that process (while maintaining the separation between arguments), and wrap # the whole thing up as a single "set" statement. # # This will of course break if any of these variables contains a newline or # an unmatched quote. # eval "set -- $( printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | xargs -n1 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | tr '\n' ' ' )" '"$@"' exec "$JAVACMD" "$@" ================================================ FILE: gradlew.bat ================================================ @rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem @rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @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 ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Resolve any "." and ".." in APP_HOME to make it shorter. for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome 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 goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% 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 goto fail :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! set EXIT_CODE=%ERRORLEVEL% if %EXIT_CODE% equ 0 set EXIT_CODE=1 if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal :omega ================================================ FILE: java/AndroidManifest.xml ================================================ ================================================ FILE: java/CMakeLists.txt ================================================ # 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. cmake_minimum_required(VERSION 3.13...3.26) project(yogajni) set(CMAKE_VERBOSE_MAKEFILE on) set(YOGA_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) include(${YOGA_ROOT}/cmake/project-defaults.cmake) add_subdirectory(${YOGA_ROOT}/yoga ${CMAKE_CURRENT_BINARY_DIR}/yoga) file(GLOB SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/jni/*.cpp) file(GLOB VERSION_SCRIPT CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/yogajni.version) add_library(yoga SHARED ${SOURCES}) target_link_libraries(yoga yogacore) target_link_options(yoga PRIVATE -Wl,--version-script=${VERSION_SCRIPT}) ================================================ FILE: java/build.gradle.kts ================================================ /* * 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. */ plugins { id("com.android.library") id("maven-publish") id("signing") id("org.jetbrains.kotlin.android") } group = "com.facebook.yoga" android { namespace = "com.facebook.yoga" compileSdk = 36 buildToolsVersion = "36.0.0" ndkVersion = "27.1.12297006" defaultConfig { minSdk = 21 consumerProguardFiles("proguard-rules.pro") ndk { abiFilters.addAll(setOf("x86", "x86_64", "armeabi-v7a", "arm64-v8a")) } externalNativeBuild { cmake { arguments("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON") } } } externalNativeBuild { cmake { path("CMakeLists.txt") } } compileOptions { targetCompatibility(JavaVersion.VERSION_17) sourceCompatibility(JavaVersion.VERSION_17) } sourceSets { named("main") { java.srcDir("com") manifest.srcFile("AndroidManifest.xml") res.srcDir("res") } } kotlinOptions { jvmTarget = "17" } publishing { multipleVariants { withSourcesJar() withJavadocJar() includeBuildTypeValues("debug", "release") } } } dependencies { implementation("com.google.code.findbugs:jsr305:3.0.2") implementation("com.facebook.soloader:soloader:0.12.1") implementation("androidx.core:core-ktx:1.16.0") testImplementation("junit:junit:4.13.2") } version = if ("USE_SNAPSHOT".byProperty.toBoolean()) { "${"VERSION_NAME".byProperty}-SNAPSHOT" } else { "VERSION_NAME".byProperty.toString() } publishing { publications { register("default") { groupId = project.group.toString() artifactId = project.name version = project.version.toString() afterEvaluate { from(components["default"]) } pom { description.set( "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 { license { name.set("MIT License") url.set("https://github.com/facebook/yoga/blob/main/LICENSE") distribution.set("repo") } } developers { developer { id.set("Meta Open Source") name.set("Meta Open Source") email.set("opensource@meta.com") } } scm { url.set("scm:git:git@github.com:facebook/yoga.git") } } } } } val signingKey = "SIGNING_KEY".byProperty val signingPwd = "SIGNING_PWD".byProperty if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) { logger.info("Signing disabled as the GPG key was not found") } else { logger.info("GPG Key found - Signing enabled") } signing { useInMemoryPgpKeys(signingKey, signingPwd) sign(publishing.publications) isRequired = !(signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) } // Fix for https://youtrack.jetbrains.com/issue/KT-46466/ // On Gradle 8+, the signing task is not correctly wired to the publishing tasks. // This requires a fix on KGP that is currently pending. val signingTasks = tasks.withType() tasks.withType().configureEach { dependsOn(signingTasks) } val String.byProperty: String? get() = providers.gradleProperty(this).orNull ================================================ FILE: java/com/facebook/yoga/LayoutPassReason.kt ================================================ /* * 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") } } } ================================================ FILE: java/com/facebook/yoga/YogaAlign.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaAlign { AUTO(0), FLEX_START(1), CENTER(2), FLEX_END(3), STRETCH(4), BASELINE(5), SPACE_BETWEEN(6), SPACE_AROUND(7), SPACE_EVENLY(8), START(9), END(10); private final int mIntValue; YogaAlign(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaAlign fromInt(int value) { switch (value) { case 0: return AUTO; case 1: return FLEX_START; case 2: return CENTER; case 3: return FLEX_END; case 4: return STRETCH; case 5: return BASELINE; case 6: return SPACE_BETWEEN; case 7: return SPACE_AROUND; case 8: return SPACE_EVENLY; case 9: return START; case 10: return END; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaBaselineFunction.kt ================================================ /* * 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 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 } ================================================ FILE: java/com/facebook/yoga/YogaBoxSizing.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaBoxSizing { BORDER_BOX(0), CONTENT_BOX(1); private final int mIntValue; YogaBoxSizing(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaBoxSizing fromInt(int value) { switch (value) { case 0: return BORDER_BOX; case 1: return CONTENT_BOX; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaConfig.kt ================================================ /* * 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 } } ================================================ FILE: java/com/facebook/yoga/YogaConfigFactory.kt ================================================ /* * 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 YogaConfigFactory { @JvmStatic public fun create(): YogaConfig = YogaConfigJNIFinalizer() } ================================================ FILE: java/com/facebook/yoga/YogaConfigJNIBase.kt ================================================ /* * 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.YogaNative.jni_YGConfigGetErrataJNI import com.facebook.yoga.YogaNative.jni_YGConfigNewJNI import com.facebook.yoga.YogaNative.jni_YGConfigSetErrataJNI import com.facebook.yoga.YogaNative.jni_YGConfigSetExperimentalFeatureEnabledJNI import com.facebook.yoga.YogaNative.jni_YGConfigSetLoggerJNI import com.facebook.yoga.YogaNative.jni_YGConfigSetPointScaleFactorJNI import com.facebook.yoga.YogaNative.jni_YGConfigSetUseWebDefaultsJNI public abstract class YogaConfigJNIBase private constructor(@JvmField protected var nativePointer: Long) : YogaConfig() { private var _logger: YogaLogger? = null init { check(nativePointer != 0L) { "Failed to allocate native memory" } } internal constructor() : this(jni_YGConfigNewJNI()) internal constructor(useVanillaJNI: Boolean) : this(jni_YGConfigNewJNI()) public override fun setExperimentalFeatureEnabled( feature: YogaExperimentalFeature, enabled: Boolean, ) { YogaNative.jni_YGConfigSetExperimentalFeatureEnabledJNI( nativePointer, feature.intValue(), enabled, ) } public override fun setUseWebDefaults(useWebDefaults: Boolean) { YogaNative.jni_YGConfigSetUseWebDefaultsJNI(nativePointer, useWebDefaults) } public override fun setPointScaleFactor(pixelsInPoint: Float) { YogaNative.jni_YGConfigSetPointScaleFactorJNI(nativePointer, pixelsInPoint) } public override fun setErrata(errata: YogaErrata) { YogaNative.jni_YGConfigSetErrataJNI(nativePointer, errata.intValue()) } public override fun getErrata(): YogaErrata = YogaErrata.fromInt(YogaNative.jni_YGConfigGetErrataJNI(nativePointer)) public override fun setLogger(logger: YogaLogger?) { _logger = logger YogaNative.jni_YGConfigSetLoggerJNI(nativePointer, logger) } public override fun getLogger(): YogaLogger? = _logger public override fun getNativePointer(): Long = nativePointer } ================================================ FILE: java/com/facebook/yoga/YogaConfigJNIFinalizer.kt ================================================ /* * 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 YogaConfigJNIFinalizer public constructor() : YogaConfigJNIBase() { /* * This is a valid use of finalize. No other mechanism is appropriate. * YogaConfigJNIFinalizer exists specifically to release JNI-allocated native * memory (via jni_YGConfigFreeJNI) when the Java object is garbage collected. * This is the established pattern for JNI prevented leak classes in Yoga. */ @Throws(Throwable::class) protected fun finalize() { freeNatives() } public fun freeNatives() { if (nativePointer != 0L) { val pointer = nativePointer nativePointer = 0 YogaNative.jni_YGConfigFreeJNI(pointer) } } } ================================================ FILE: java/com/facebook/yoga/YogaConstants.kt ================================================ /* * 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 } ================================================ FILE: java/com/facebook/yoga/YogaDimension.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaDimension { WIDTH(0), HEIGHT(1); private final int mIntValue; YogaDimension(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaDimension fromInt(int value) { switch (value) { case 0: return WIDTH; case 1: return HEIGHT; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaDirection.kt ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga public enum class YogaDirection(public val intValue: Int) { INHERIT(0), LTR(1), RTL(2); public fun intValue(): Int = intValue public companion object { @JvmStatic public fun fromInt(value: Int): YogaDirection = when (value) { 0 -> INHERIT 1 -> LTR 2 -> RTL else -> throw IllegalArgumentException("Unknown enum value: $value") } } } ================================================ FILE: java/com/facebook/yoga/YogaDisplay.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaDisplay { FLEX(0), NONE(1), CONTENTS(2), GRID(3); private final int mIntValue; YogaDisplay(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaDisplay fromInt(int value) { switch (value) { case 0: return FLEX; case 1: return NONE; case 2: return CONTENTS; case 3: return GRID; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaEdge.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaEdge { LEFT(0), TOP(1), RIGHT(2), BOTTOM(3), START(4), END(5), HORIZONTAL(6), VERTICAL(7), ALL(8); private final int mIntValue; YogaEdge(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaEdge fromInt(int value) { switch (value) { case 0: return LEFT; case 1: return TOP; case 2: return RIGHT; case 3: return BOTTOM; case 4: return START; case 5: return END; case 6: return HORIZONTAL; case 7: return VERTICAL; case 8: return ALL; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaErrata.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaErrata { NONE(0), STRETCH_FLEX_BASIS(1), ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2), ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4), ALL(2147483647), CLASSIC(2147483646); private final int mIntValue; YogaErrata(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaErrata fromInt(int value) { switch (value) { case 0: return NONE; case 1: return STRETCH_FLEX_BASIS; case 2: return ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING; case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE; case 2147483647: return ALL; case 2147483646: return CLASSIC; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaExperimentalFeature.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaExperimentalFeature { WEB_FLEX_BASIS(0), FIX_FLEX_BASIS_FIT_CONTENT(1); private final int mIntValue; YogaExperimentalFeature(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaExperimentalFeature fromInt(int value) { switch (value) { case 0: return WEB_FLEX_BASIS; case 1: return FIX_FLEX_BASIS_FIT_CONTENT; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaFlexDirection.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaFlexDirection { COLUMN(0), COLUMN_REVERSE(1), ROW(2), ROW_REVERSE(3); private final int mIntValue; YogaFlexDirection(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaFlexDirection fromInt(int value) { switch (value) { case 0: return COLUMN; case 1: return COLUMN_REVERSE; case 2: return ROW; case 3: return ROW_REVERSE; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaGridTrackType.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaGridTrackType { AUTO(0), POINTS(1), PERCENT(2), FR(3), MINMAX(4); private final int mIntValue; YogaGridTrackType(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaGridTrackType fromInt(int value) { switch (value) { case 0: return AUTO; case 1: return POINTS; case 2: return PERCENT; case 3: return FR; case 4: return MINMAX; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaGutter.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaGutter { COLUMN(0), ROW(1), ALL(2); private final int mIntValue; YogaGutter(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaGutter fromInt(int value) { switch (value) { case 0: return COLUMN; case 1: return ROW; case 2: return ALL; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaJustify.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaJustify { AUTO(0), FLEX_START(1), CENTER(2), FLEX_END(3), SPACE_BETWEEN(4), SPACE_AROUND(5), SPACE_EVENLY(6), STRETCH(7), START(8), END(9); private final int mIntValue; YogaJustify(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaJustify fromInt(int value) { switch (value) { case 0: return AUTO; case 1: return FLEX_START; case 2: return CENTER; case 3: return FLEX_END; case 4: return SPACE_BETWEEN; case 5: return SPACE_AROUND; case 6: return SPACE_EVENLY; case 7: return STRETCH; case 8: return START; case 9: return END; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaLayoutType.kt ================================================ /* * 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") } } } ================================================ FILE: java/com/facebook/yoga/YogaLogLevel.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; import com.facebook.yoga.annotations.DoNotStrip; @DoNotStrip public enum YogaLogLevel { ERROR(0), WARN(1), INFO(2), DEBUG(3), VERBOSE(4), FATAL(5); private final int mIntValue; YogaLogLevel(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } @DoNotStrip public static YogaLogLevel fromInt(int value) { switch (value) { case 0: return ERROR; case 1: return WARN; case 2: return INFO; case 3: return DEBUG; case 4: return VERBOSE; case 5: return FATAL; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaLogger.kt ================================================ /* * 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 /** * 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) } ================================================ FILE: java/com/facebook/yoga/YogaMeasureFunction.kt ================================================ /* * 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 } ================================================ FILE: java/com/facebook/yoga/YogaMeasureMode.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaMeasureMode { UNDEFINED(0), EXACTLY(1), AT_MOST(2); private final int mIntValue; YogaMeasureMode(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaMeasureMode fromInt(int value) { switch (value) { case 0: return UNDEFINED; case 1: return EXACTLY; case 2: return AT_MOST; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaMeasureOutput.kt ================================================ /* * 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()) } ================================================ FILE: java/com/facebook/yoga/YogaNative.kt ================================================ /* * 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, ) @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, ) } ================================================ FILE: java/com/facebook/yoga/YogaNode.kt ================================================ /* * 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 YogaNode : YogaProps { /** The interface the [getData] object can optionally implement. */ public fun interface Inputs { /** Requests the data object to disable mutations of its inputs. */ public fun freeze(node: YogaNode, parent: YogaNode?) } public abstract fun reset() public abstract val childCount: Int public abstract fun getChildAt(i: Int): YogaNode public abstract fun addChildAt(child: YogaNode, i: Int) abstract override fun setIsReferenceBaseline(isReferenceBaseline: Boolean) public abstract val isReferenceBaseline: Boolean public abstract fun removeChildAt(i: Int): YogaNode /** * @returns the [YogaNode] that owns this [YogaNode]. The owner is used to identify the YogaTree * that a [YogaNode] belongs to. This method will return the parent of the [YogaNode] when the * [YogaNode] only belongs to one YogaTree or null when the [YogaNode] is shared between two or * more YogaTrees. */ public abstract fun getOwner(): YogaNode? @Deprecated( "Use getOwner() instead. This will be removed in the next version. ", replaceWith = ReplaceWith("getOwner()"), ) public abstract fun getParent(): YogaNode? public abstract fun indexOf(child: YogaNode): Int public abstract fun calculateLayout(width: Float, height: Float) public abstract fun hasNewLayout(): Boolean public abstract fun dirty() public abstract fun isDirty(): Boolean public abstract fun copyStyle(srcNode: YogaNode) public abstract fun markLayoutSeen() abstract override val styleDirection: YogaDirection abstract override fun setDirection(direction: YogaDirection) abstract override var flexDirection: YogaFlexDirection abstract override var justifyContent: YogaJustify abstract override var alignItems: YogaAlign abstract override var alignSelf: YogaAlign abstract override var alignContent: YogaAlign abstract override var positionType: YogaPositionType abstract override var boxSizing: YogaBoxSizing abstract override var wrap: YogaWrap public abstract var overflow: YogaOverflow? public abstract var display: YogaDisplay? abstract override var flex: Float abstract override var flexGrow: Float abstract override var flexShrink: Float abstract override val flexBasis: YogaValue abstract override fun setFlexBasis(flexBasis: Float) abstract override fun setFlexBasisPercent(percent: Float) abstract override fun setFlexBasisAuto() abstract override fun setFlexBasisMaxContent() abstract override fun setFlexBasisFitContent() abstract override fun setFlexBasisStretch() abstract override fun getMargin(edge: YogaEdge): YogaValue abstract override fun setMargin(edge: YogaEdge, margin: Float) abstract override fun setMarginPercent(edge: YogaEdge, percent: Float) abstract override fun setMarginAuto(edge: YogaEdge) abstract override fun getPadding(edge: YogaEdge): YogaValue abstract override fun setPadding(edge: YogaEdge, padding: Float) abstract override fun setPaddingPercent(edge: YogaEdge, percent: Float) abstract override fun getBorder(edge: YogaEdge): Float abstract override fun setBorder(edge: YogaEdge, value: Float) abstract override fun getPosition(edge: YogaEdge): YogaValue abstract override fun setPosition(edge: YogaEdge, position: Float) abstract override fun setPositionPercent(edge: YogaEdge, percent: Float) public abstract fun setPositionAuto(edge: YogaEdge) abstract override val width: YogaValue abstract override fun setWidth(width: Float) abstract override fun setWidthPercent(percent: Float) abstract override fun setWidthAuto() abstract override fun setWidthMaxContent() abstract override fun setWidthFitContent() abstract override fun setWidthStretch() abstract override val height: YogaValue abstract override fun setHeight(height: Float) abstract override fun setHeightPercent(percent: Float) abstract override fun setHeightAuto() abstract override fun setHeightMaxContent() abstract override fun setHeightFitContent() abstract override fun setHeightStretch() abstract override val minWidth: YogaValue abstract override fun setMinWidth(minWidth: Float) abstract override fun setMinWidthPercent(percent: Float) abstract override fun setMinWidthMaxContent() abstract override fun setMinWidthFitContent() abstract override fun setMinWidthStretch() abstract override val minHeight: YogaValue abstract override fun setMinHeight(minHeight: Float) abstract override fun setMinHeightPercent(percent: Float) abstract override fun setMinHeightMaxContent() abstract override fun setMinHeightFitContent() abstract override fun setMinHeightStretch() abstract override val maxWidth: YogaValue abstract override fun setMaxWidth(maxWidth: Float) abstract override fun setMaxWidthPercent(percent: Float) abstract override fun setMaxWidthMaxContent() abstract override fun setMaxWidthFitContent() abstract override fun setMaxWidthStretch() abstract override val maxHeight: YogaValue abstract override fun setMaxHeight(maxHeight: Float) abstract override fun setMaxHeightPercent(percent: Float) abstract override fun setMaxHeightMaxContent() abstract override fun setMaxHeightFitContent() abstract override fun setMaxHeightStretch() abstract override var aspectRatio: Float public abstract fun getGap(gutter: YogaGutter): YogaValue public abstract fun setGap(gutter: YogaGutter, gapLength: Float) public abstract fun setGapPercent(gutter: YogaGutter, gapLength: Float) public abstract val layoutX: Float public abstract val layoutY: Float public abstract val layoutWidth: Float public abstract val layoutHeight: Float public abstract fun getLayoutMargin(edge: YogaEdge): Float public abstract fun getLayoutPadding(edge: YogaEdge): Float public abstract fun getLayoutBorder(edge: YogaEdge): Float public abstract val layoutDirection: YogaDirection abstract override fun setMeasureFunction(measureFunction: YogaMeasureFunction) abstract override fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction) public abstract val isMeasureDefined: Boolean public abstract val isBaselineDefined: Boolean public abstract var data: Any? public abstract fun cloneWithoutChildren(): YogaNode public abstract fun cloneWithChildren(): YogaNode public abstract fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean) } ================================================ FILE: java/com/facebook/yoga/YogaNodeFactory.kt ================================================ /* * 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) } ================================================ FILE: java/com/facebook/yoga/YogaNodeJNIBase.java ================================================ /* * 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 java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; @DoNotStrip public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable { /* Those flags needs be in sync with YGJNI.h */ private static final byte MARGIN = 1; private static final byte PADDING = 2; private static final byte BORDER = 4; private static final byte HAS_NEW_LAYOUT = 16; private static final byte LAYOUT_EDGE_SET_FLAG_INDEX = 0; private static final byte LAYOUT_WIDTH_INDEX = 1; private static final byte LAYOUT_HEIGHT_INDEX = 2; private static final byte LAYOUT_LEFT_INDEX = 3; private static final byte LAYOUT_TOP_INDEX = 4; private static final byte LAYOUT_DIRECTION_INDEX = 5; private static final byte LAYOUT_MARGIN_START_INDEX = 6; private static final byte LAYOUT_PADDING_START_INDEX = 10; private static final byte LAYOUT_BORDER_START_INDEX = 14; @Nullable private YogaNodeJNIBase mOwner; @Nullable private YogaConfig mConfig; @Nullable private List mChildren; @Nullable private YogaMeasureFunction mMeasureFunction; @Nullable private YogaBaselineFunction mBaselineFunction; protected long mNativePointer; @Nullable private Object mData; @DoNotStrip private @Nullable float[] arr = null; @DoNotStrip private int mLayoutDirection = 0; private boolean mHasNewLayout = true; private YogaNodeJNIBase(long nativePointer) { if (nativePointer == 0) { throw new IllegalStateException("Failed to allocate native memory"); } mNativePointer = nativePointer; } YogaNodeJNIBase() { this(YogaNative.jni_YGNodeNewJNI()); } YogaNodeJNIBase(YogaConfig config) { this(YogaNative.jni_YGNodeNewWithConfigJNI(((YogaConfigJNIBase) config).nativePointer)); mConfig = config; // makes sure the YogaConfig is not garbage collected } public void reset() { mMeasureFunction = null; mBaselineFunction = null; mData = null; arr = null; mHasNewLayout = true; mLayoutDirection = 0; YogaNative.jni_YGNodeResetJNI(mNativePointer); } public int getChildCount() { return mChildren == null ? 0 : mChildren.size(); } public YogaNodeJNIBase getChildAt(int i) { if (mChildren == null) { throw new IllegalStateException("YogaNode does not have children"); } return mChildren.get(i); } public void addChildAt(YogaNode c, int i) { if (!(c instanceof YogaNodeJNIBase)) { return; } YogaNodeJNIBase child = (YogaNodeJNIBase) c; if (child.mOwner != null) { throw new IllegalStateException("Child already has a parent, it must be removed first."); } if (mChildren == null) { mChildren = new ArrayList<>(4); } mChildren.add(i, child); child.mOwner = this; YogaNative.jni_YGNodeInsertChildJNI(mNativePointer, child.mNativePointer, i); } public void setIsReferenceBaseline(boolean isReferenceBaseline) { YogaNative.jni_YGNodeSetIsReferenceBaselineJNI(mNativePointer, isReferenceBaseline); } public boolean isReferenceBaseline() { return YogaNative.jni_YGNodeIsReferenceBaselineJNI(mNativePointer); } public void swapChildAt(YogaNode newChild, int position) { if (!(newChild instanceof YogaNodeJNIBase)) { return; } YogaNodeJNIBase child = (YogaNodeJNIBase) newChild; mChildren.remove(position); mChildren.add(position, child); child.mOwner = this; YogaNative.jni_YGNodeSwapChildJNI(mNativePointer, child.mNativePointer, position); } @Override public YogaNodeJNIBase cloneWithChildren() { try { YogaNodeJNIBase clonedYogaNode = (YogaNodeJNIBase) super.clone(); if (clonedYogaNode.mChildren != null) { clonedYogaNode.mChildren = new ArrayList<>(clonedYogaNode.mChildren); } long clonedNativePointer = YogaNative.jni_YGNodeCloneJNI(mNativePointer); clonedYogaNode.mOwner = null; clonedYogaNode.mNativePointer = clonedNativePointer; for (int i = 0; i < clonedYogaNode.getChildCount(); i++) { clonedYogaNode.swapChildAt(clonedYogaNode.getChildAt(i).cloneWithChildren(), i); } return clonedYogaNode; } catch (CloneNotSupportedException ex) { // This class implements Cloneable, this should not happen throw new RuntimeException(ex); } } @Override public YogaNodeJNIBase cloneWithoutChildren() { try { YogaNodeJNIBase clonedYogaNode = (YogaNodeJNIBase) super.clone(); long clonedNativePointer = YogaNative.jni_YGNodeCloneJNI(mNativePointer); clonedYogaNode.mOwner = null; clonedYogaNode.mNativePointer = clonedNativePointer; clonedYogaNode.clearChildren(); return clonedYogaNode; } catch (CloneNotSupportedException ex) { // This class implements Cloneable, this should not happen throw new RuntimeException(ex); } } private void clearChildren() { mChildren = null; YogaNative.jni_YGNodeRemoveAllChildrenJNI(mNativePointer); } public YogaNodeJNIBase removeChildAt(int i) { if (mChildren == null) { throw new IllegalStateException( "Trying to remove a child of a YogaNode that does not have children"); } final YogaNodeJNIBase child = mChildren.remove(i); child.mOwner = null; YogaNative.jni_YGNodeRemoveChildJNI(mNativePointer, child.mNativePointer); return child; } /** * The owner is used to identify the YogaTree that a {@link YogaNode} belongs to. This method will * return the parent of the {@link YogaNode} when the {@link YogaNode} only belongs to one * YogaTree or null when the {@link YogaNode} is shared between two or more YogaTrees. * * @return the {@link YogaNode} that owns this {@link YogaNode}. */ @Nullable public YogaNodeJNIBase getOwner() { return mOwner; } /** @deprecated Use #getOwner() instead. This will be removed in the next version. */ @Deprecated @Nullable public YogaNodeJNIBase getParent() { return getOwner(); } public int indexOf(YogaNode child) { return mChildren == null ? -1 : mChildren.indexOf(child); } public void calculateLayout(float width, float height) { long[] nativePointers = null; YogaNodeJNIBase[] nodes = null; freeze(null); ArrayList n = new ArrayList<>(); n.add(this); for (int i = 0; i < n.size(); ++i) { final YogaNodeJNIBase parent = n.get(i); List children = parent.mChildren; if (children != null) { for (YogaNodeJNIBase child : children) { child.freeze(parent); n.add(child); } } } nodes = n.toArray(new YogaNodeJNIBase[n.size()]); nativePointers = new long[nodes.length]; for (int i = 0; i < nodes.length; ++i) { nativePointers[i] = nodes[i].mNativePointer; } YogaNative.jni_YGNodeCalculateLayoutJNI(mNativePointer, width, height, nativePointers, nodes); } private void freeze(YogaNode parent) { Object data = getData(); if (data instanceof Inputs) { ((Inputs) data).freeze(this, parent); } } public void dirty() { YogaNative.jni_YGNodeMarkDirtyJNI(mNativePointer); } public boolean isDirty() { return YogaNative.jni_YGNodeIsDirtyJNI(mNativePointer); } @Override public void copyStyle(YogaNode srcNode) { if (!(srcNode instanceof YogaNodeJNIBase)) { return; } YogaNative.jni_YGNodeCopyStyleJNI(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer); } public YogaDirection getStyleDirection() { return YogaDirection.fromInt(YogaNative.jni_YGNodeStyleGetDirectionJNI(mNativePointer)); } public void setDirection(YogaDirection direction) { YogaNative.jni_YGNodeStyleSetDirectionJNI(mNativePointer, direction.intValue()); } public YogaFlexDirection getFlexDirection() { return YogaFlexDirection.fromInt(YogaNative.jni_YGNodeStyleGetFlexDirectionJNI(mNativePointer)); } public void setFlexDirection(YogaFlexDirection flexDirection) { YogaNative.jni_YGNodeStyleSetFlexDirectionJNI(mNativePointer, flexDirection.intValue()); } public YogaJustify getJustifyContent() { return YogaJustify.fromInt(YogaNative.jni_YGNodeStyleGetJustifyContentJNI(mNativePointer)); } public void setJustifyContent(YogaJustify justifyContent) { YogaNative.jni_YGNodeStyleSetJustifyContentJNI(mNativePointer, justifyContent.intValue()); } public YogaAlign getAlignItems() { return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignItemsJNI(mNativePointer)); } public void setAlignItems(YogaAlign alignItems) { YogaNative.jni_YGNodeStyleSetAlignItemsJNI(mNativePointer, alignItems.intValue()); } public YogaAlign getAlignSelf() { return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignSelfJNI(mNativePointer)); } public void setAlignSelf(YogaAlign alignSelf) { YogaNative.jni_YGNodeStyleSetAlignSelfJNI(mNativePointer, alignSelf.intValue()); } public YogaAlign getAlignContent() { return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignContentJNI(mNativePointer)); } public void setAlignContent(YogaAlign alignContent) { YogaNative.jni_YGNodeStyleSetAlignContentJNI(mNativePointer, alignContent.intValue()); } public YogaPositionType getPositionType() { return YogaPositionType.fromInt(YogaNative.jni_YGNodeStyleGetPositionTypeJNI(mNativePointer)); } public void setPositionType(YogaPositionType positionType) { 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)); } public void setWrap(YogaWrap flexWrap) { YogaNative.jni_YGNodeStyleSetFlexWrapJNI(mNativePointer, flexWrap.intValue()); } public YogaOverflow getOverflow() { return YogaOverflow.fromInt(YogaNative.jni_YGNodeStyleGetOverflowJNI(mNativePointer)); } public void setOverflow(YogaOverflow overflow) { YogaNative.jni_YGNodeStyleSetOverflowJNI(mNativePointer, overflow.intValue()); } public YogaDisplay getDisplay() { return YogaDisplay.fromInt(YogaNative.jni_YGNodeStyleGetDisplayJNI(mNativePointer)); } public void setDisplay(YogaDisplay display) { YogaNative.jni_YGNodeStyleSetDisplayJNI(mNativePointer, display.intValue()); } public float getFlex() { return YogaNative.jni_YGNodeStyleGetFlexJNI(mNativePointer); } public void setFlex(float flex) { YogaNative.jni_YGNodeStyleSetFlexJNI(mNativePointer, flex); } public float getFlexGrow() { return YogaNative.jni_YGNodeStyleGetFlexGrowJNI(mNativePointer); } public void setFlexGrow(float flexGrow) { YogaNative.jni_YGNodeStyleSetFlexGrowJNI(mNativePointer, flexGrow); } public float getFlexShrink() { return YogaNative.jni_YGNodeStyleGetFlexShrinkJNI(mNativePointer); } public void setFlexShrink(float flexShrink) { YogaNative.jni_YGNodeStyleSetFlexShrinkJNI(mNativePointer, flexShrink); } public YogaValue getFlexBasis() { return valueFromLong(YogaNative.jni_YGNodeStyleGetFlexBasisJNI(mNativePointer)); } public void setFlexBasis(float flexBasis) { YogaNative.jni_YGNodeStyleSetFlexBasisJNI(mNativePointer, flexBasis); } public void setFlexBasisPercent(float percent) { YogaNative.jni_YGNodeStyleSetFlexBasisPercentJNI(mNativePointer, percent); } public void setFlexBasisAuto() { 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())); } public void setMargin(YogaEdge edge, float margin) { YogaNative.jni_YGNodeStyleSetMarginJNI(mNativePointer, edge.intValue(), margin); } public void setMarginPercent(YogaEdge edge, float percent) { YogaNative.jni_YGNodeStyleSetMarginPercentJNI(mNativePointer, edge.intValue(), percent); } public void setMarginAuto(YogaEdge edge) { YogaNative.jni_YGNodeStyleSetMarginAutoJNI(mNativePointer, edge.intValue()); } public YogaValue getPadding(YogaEdge edge) { return valueFromLong(YogaNative.jni_YGNodeStyleGetPaddingJNI(mNativePointer, edge.intValue())); } public void setPadding(YogaEdge edge, float padding) { YogaNative.jni_YGNodeStyleSetPaddingJNI(mNativePointer, edge.intValue(), padding); } public void setPaddingPercent(YogaEdge edge, float percent) { YogaNative.jni_YGNodeStyleSetPaddingPercentJNI(mNativePointer, edge.intValue(), percent); } public float getBorder(YogaEdge edge) { return YogaNative.jni_YGNodeStyleGetBorderJNI(mNativePointer, edge.intValue()); } public void setBorder(YogaEdge edge, float border) { YogaNative.jni_YGNodeStyleSetBorderJNI(mNativePointer, edge.intValue(), border); } public YogaValue getPosition(YogaEdge edge) { return valueFromLong(YogaNative.jni_YGNodeStyleGetPositionJNI(mNativePointer, edge.intValue())); } public void setPosition(YogaEdge edge, float position) { YogaNative.jni_YGNodeStyleSetPositionJNI(mNativePointer, edge.intValue(), position); } public void setPositionPercent(YogaEdge edge, float percent) { 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)); } public void setWidth(float width) { YogaNative.jni_YGNodeStyleSetWidthJNI(mNativePointer, width); } public void setWidthPercent(float percent) { YogaNative.jni_YGNodeStyleSetWidthPercentJNI(mNativePointer, percent); } public void setWidthAuto() { 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)); } public void setHeight(float height) { YogaNative.jni_YGNodeStyleSetHeightJNI(mNativePointer, height); } public void setHeightPercent(float percent) { YogaNative.jni_YGNodeStyleSetHeightPercentJNI(mNativePointer, percent); } public void setHeightAuto() { 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)); } public void setMinWidth(float minWidth) { YogaNative.jni_YGNodeStyleSetMinWidthJNI(mNativePointer, minWidth); } public void setMinWidthPercent(float percent) { 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)); } public void setMinHeight(float minHeight) { YogaNative.jni_YGNodeStyleSetMinHeightJNI(mNativePointer, minHeight); } public void setMinHeightPercent(float percent) { 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)); } public void setMaxWidth(float maxWidth) { YogaNative.jni_YGNodeStyleSetMaxWidthJNI(mNativePointer, maxWidth); } public void setMaxWidthPercent(float percent) { 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)); } public void setMaxHeight(float maxheight) { YogaNative.jni_YGNodeStyleSetMaxHeightJNI(mNativePointer, maxheight); } public void setMaxHeightPercent(float percent) { 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); } public void setAspectRatio(float aspectRatio) { YogaNative.jni_YGNodeStyleSetAspectRatioJNI(mNativePointer, aspectRatio); } public void setMeasureFunction(YogaMeasureFunction measureFunction) { mMeasureFunction = measureFunction; YogaNative.jni_YGNodeSetHasMeasureFuncJNI(mNativePointer, measureFunction != null); } @Override public void setAlwaysFormsContainingBlock(boolean alwaysFormsContainingBlock) { YogaNative.jni_YGNodeSetAlwaysFormsContainingBlockJNI(mNativePointer, alwaysFormsContainingBlock); } // Implementation Note: Why this method needs to stay final // // We cache the jmethodid for this method in Yoga code. This means that even if a subclass // were to override measure, we'd still call this implementation from layout code since the // overriding method will have a different jmethodid. This is final to prevent that mistake. @DoNotStrip public final long measure(float width, int widthMode, float height, int heightMode) { if (!isMeasureDefined()) { throw new RuntimeException("Measure function isn't defined!"); } return mMeasureFunction.measure( this, width, YogaMeasureMode.fromInt(widthMode), height, YogaMeasureMode.fromInt(heightMode)); } public void setBaselineFunction(YogaBaselineFunction baselineFunction) { mBaselineFunction = baselineFunction; YogaNative.jni_YGNodeSetHasBaselineFuncJNI(mNativePointer, baselineFunction != null); } @DoNotStrip public final float baseline(float width, float height) { return mBaselineFunction.baseline(this, width, height); } public boolean isMeasureDefined() { return mMeasureFunction != null; } @Override public boolean isBaselineDefined() { return mBaselineFunction != null; } public void setData(Object data) { mData = data; } @Override public @Nullable Object getData() { return mData; } /** * This method replaces the child at childIndex position with the newNode received by parameter. * This is different than calling removeChildAt and addChildAt because this method ONLY replaces * the child in the mChildren datastructure. @DoNotStrip: called from JNI * * @return the nativePointer of the newNode {@link YogaNode} */ @DoNotStrip private final long replaceChild(YogaNodeJNIBase newNode, int childIndex) { if (mChildren == null) { throw new IllegalStateException("Cannot replace child. YogaNode does not have children"); } mChildren.remove(childIndex); mChildren.add(childIndex, newNode); newNode.mOwner = this; return newNode.mNativePointer; } private static YogaValue valueFromLong(long raw) { return new YogaValue(Float.intBitsToFloat((int) raw), (int) (raw >> 32)); } @Override public float getLayoutX() { return arr != null ? arr[LAYOUT_LEFT_INDEX] : 0; } @Override public float getLayoutY() { return arr != null ? arr[LAYOUT_TOP_INDEX] : 0; } @Override public float getLayoutWidth() { return arr != null ? arr[LAYOUT_WIDTH_INDEX] : 0; } @Override public float getLayoutHeight() { return arr != null ? arr[LAYOUT_HEIGHT_INDEX] : 0; } @Override public float getLayoutMargin(YogaEdge edge) { if (arr != null && ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & MARGIN) == MARGIN) { switch (edge) { case LEFT: return arr[LAYOUT_MARGIN_START_INDEX]; case TOP: return arr[LAYOUT_MARGIN_START_INDEX + 1]; case RIGHT: return arr[LAYOUT_MARGIN_START_INDEX + 2]; case BOTTOM: return arr[LAYOUT_MARGIN_START_INDEX + 3]; case START: return getLayoutDirection() == YogaDirection.RTL ? arr[LAYOUT_MARGIN_START_INDEX + 2] : arr[LAYOUT_MARGIN_START_INDEX]; case END: return getLayoutDirection() == YogaDirection.RTL ? arr[LAYOUT_MARGIN_START_INDEX] : arr[LAYOUT_MARGIN_START_INDEX + 2]; default: throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands"); } } else { return 0; } } @Override public float getLayoutPadding(YogaEdge edge) { if (arr != null && ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & PADDING) == PADDING) { int paddingStartIndex = LAYOUT_PADDING_START_INDEX - ((((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & MARGIN) == MARGIN) ? 0 : 4); switch (edge) { case LEFT: return arr[paddingStartIndex]; case TOP: return arr[paddingStartIndex + 1]; case RIGHT: return arr[paddingStartIndex + 2]; case BOTTOM: return arr[paddingStartIndex + 3]; case START: return getLayoutDirection() == YogaDirection.RTL ? arr[paddingStartIndex + 2] : arr[paddingStartIndex]; case END: return getLayoutDirection() == YogaDirection.RTL ? arr[paddingStartIndex] : arr[paddingStartIndex + 2]; default: throw new IllegalArgumentException("Cannot get layout paddings of multi-edge shorthands"); } } else { return 0; } } @Override public float getLayoutBorder(YogaEdge edge) { if (arr != null && ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & BORDER) == BORDER) { int borderStartIndex = LAYOUT_BORDER_START_INDEX - ((((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & MARGIN) == MARGIN) ? 0 : 4) - ((((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & PADDING) == PADDING) ? 0 : 4); switch (edge) { case LEFT: return arr[borderStartIndex]; case TOP: return arr[borderStartIndex + 1]; case RIGHT: return arr[borderStartIndex + 2]; case BOTTOM: return arr[borderStartIndex + 3]; case START: return getLayoutDirection() == YogaDirection.RTL ? arr[borderStartIndex + 2] : arr[borderStartIndex]; case END: return getLayoutDirection() == YogaDirection.RTL ? arr[borderStartIndex] : arr[borderStartIndex + 2]; default: throw new IllegalArgumentException("Cannot get layout border of multi-edge shorthands"); } } else { return 0; } } @Override public YogaDirection getLayoutDirection() { return YogaDirection.fromInt( arr != null ? (int) arr[LAYOUT_DIRECTION_INDEX] : mLayoutDirection); } @Override public boolean hasNewLayout() { if (arr != null) { return (((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX]) & HAS_NEW_LAYOUT) == HAS_NEW_LAYOUT; } else { return mHasNewLayout; } } @Override public void markLayoutSeen() { if (arr != null) { arr[LAYOUT_EDGE_SET_FLAG_INDEX] = ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX]) & ~(HAS_NEW_LAYOUT); } mHasNewLayout = false; } @Override public YogaValue getGap(YogaGutter gutter) { return valueFromLong(YogaNative.jni_YGNodeStyleGetGapJNI(mNativePointer, gutter.intValue())); } @Override public void setGap(YogaGutter gutter, float gapLength) { YogaNative.jni_YGNodeStyleSetGapJNI(mNativePointer, gutter.intValue(), gapLength); } @Override public void setGapPercent(YogaGutter gutter, float gapLength) { YogaNative.jni_YGNodeStyleSetGapPercentJNI(mNativePointer, gutter.intValue(), gapLength); } } ================================================ FILE: java/com/facebook/yoga/YogaNodeJNIFinalizer.kt ================================================ /* * 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 YogaNodeJNIFinalizer : YogaNodeJNIBase { public constructor() : super() public constructor(config: YogaConfig) : super(config) /* * This is a valid use of finalize. No other mechanism is appropriate. * YogaNodeJNIFinalizer exists specifically to release JNI-allocated native * memory (via jni_YGNodeFinalizeJNI) when the Java object is garbage collected. * This is the established pattern for JNI prevented leak classes in Yoga. */ @Throws(Throwable::class) protected fun finalize() { freeNatives() } public fun freeNatives() { if (mNativePointer != 0L) { val nativePointer = mNativePointer mNativePointer = 0 YogaNative.jni_YGNodeFinalizeJNI(nativePointer) } } } ================================================ FILE: java/com/facebook/yoga/YogaNodeType.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaNodeType { DEFAULT(0), TEXT(1); private final int mIntValue; YogaNodeType(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaNodeType fromInt(int value) { switch (value) { case 0: return DEFAULT; case 1: return TEXT; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaOverflow.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaOverflow { VISIBLE(0), HIDDEN(1), SCROLL(2); private final int mIntValue; YogaOverflow(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaOverflow fromInt(int value) { switch (value) { case 0: return VISIBLE; case 1: return HIDDEN; case 2: return SCROLL; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaPositionType.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaPositionType { STATIC(0), RELATIVE(1), ABSOLUTE(2); private final int mIntValue; YogaPositionType(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaPositionType fromInt(int value) { switch (value) { case 0: return STATIC; case 1: return RELATIVE; case 2: return ABSOLUTE; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/YogaProps.kt ================================================ /* * 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 YogaProps { /* Width properties */ public fun setWidth(width: Float) public fun setWidthPercent(percent: Float) public fun setWidthAuto() public fun setWidthMaxContent() public fun setWidthFitContent() public fun setWidthStretch() public fun setMinWidth(minWidth: Float) public fun setMinWidthPercent(percent: Float) public fun setMinWidthMaxContent() public fun setMinWidthFitContent() public fun setMinWidthStretch() public fun setMaxWidth(maxWidth: Float) public fun setMaxWidthPercent(percent: Float) public fun setMaxWidthMaxContent() public fun setMaxWidthFitContent() public fun setMaxWidthStretch() /* Height properties */ public fun setHeight(height: Float) public fun setHeightPercent(percent: Float) public fun setHeightAuto() public fun setHeightMaxContent() public fun setHeightFitContent() public fun setHeightStretch() public fun setMinHeight(minHeight: Float) public fun setMinHeightPercent(percent: Float) public fun setMinHeightMaxContent() public fun setMinHeightFitContent() public fun setMinHeightStretch() public fun setMaxHeight(maxHeight: Float) public fun setMaxHeightPercent(percent: Float) public fun setMaxHeightMaxContent() public fun setMaxHeightFitContent() public fun setMaxHeightStretch() /* Margin properties */ public fun setMargin(edge: YogaEdge, margin: Float) public fun setMarginPercent(edge: YogaEdge, percent: Float) public fun setMarginAuto(edge: YogaEdge) /* Padding properties */ public fun setPadding(edge: YogaEdge, padding: Float) public fun setPaddingPercent(edge: YogaEdge, percent: Float) /* Position properties */ public fun setPosition(edge: YogaEdge, position: Float) public fun setPositionPercent(edge: YogaEdge, percent: Float) /* Border properties */ public fun setBorder(edge: YogaEdge, value: Float) /* Flex basis properties */ public fun setFlexBasisAuto() public fun setFlexBasisPercent(percent: Float) public fun setFlexBasis(flexBasis: Float) public fun setFlexBasisMaxContent() public fun setFlexBasisFitContent() public fun setFlexBasisStretch() /* Direction property - setter has different name than getter */ public fun setDirection(direction: YogaDirection) /* Other functions */ public fun setIsReferenceBaseline(isReferenceBaseline: Boolean) public fun setMeasureFunction(measureFunction: YogaMeasureFunction) public fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction) /* Mutable properties - getter and setter with matching types */ public var flexDirection: YogaFlexDirection public var justifyContent: YogaJustify public var alignItems: YogaAlign public var alignSelf: YogaAlign public var alignContent: YogaAlign public var positionType: YogaPositionType public var flexGrow: Float public var flexShrink: Float public var flex: Float public var aspectRatio: Float public var wrap: YogaWrap public var boxSizing: YogaBoxSizing /* Read-only properties - getter only, or setter has different type/name */ public val styleDirection: YogaDirection public val width: YogaValue public val minWidth: YogaValue public val maxWidth: YogaValue public val height: YogaValue public val minHeight: YogaValue public val maxHeight: YogaValue public val flexBasis: YogaValue /* Functions with parameters */ public fun getMargin(edge: YogaEdge): YogaValue public fun getPadding(edge: YogaEdge): YogaValue public fun getPosition(edge: YogaEdge): YogaValue public fun getBorder(edge: YogaEdge): Float } ================================================ FILE: java/com/facebook/yoga/YogaStyleInputs.kt ================================================ /* * 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 } ================================================ FILE: java/com/facebook/yoga/YogaUnit.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaUnit { UNDEFINED(0), POINT(1), PERCENT(2), AUTO(3), MAX_CONTENT(4), FIT_CONTENT(5), STRETCH(6); private final int mIntValue; YogaUnit(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaUnit fromInt(int value) { switch (value) { case 0: return UNDEFINED; 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); } } } ================================================ FILE: java/com/facebook/yoga/YogaValue.kt ================================================ /* * 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) } } } ================================================ FILE: java/com/facebook/yoga/YogaWrap.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py package com.facebook.yoga; public enum YogaWrap { NO_WRAP(0), WRAP(1), WRAP_REVERSE(2); private final int mIntValue; YogaWrap(int intValue) { mIntValue = intValue; } public int intValue() { return mIntValue; } public static YogaWrap fromInt(int value) { switch (value) { case 0: return NO_WRAP; case 1: return WRAP; case 2: return WRAP_REVERSE; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } } ================================================ FILE: java/com/facebook/yoga/annotations/DoNotStrip.kt ================================================ /* * 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 ================================================ FILE: java/gen/com/facebook/yoga/BuildConfig.java ================================================ /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /*___Generated_by_IDEA___*/ package com.facebook.yoga; /* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */ public final class BuildConfig { public final static boolean DEBUG = Boolean.parseBoolean(null); } ================================================ FILE: java/jni/LayoutContext.cpp ================================================ /* * 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. */ #include #include "LayoutContext.h" namespace facebook::yoga::vanillajni { namespace { std::stack& getContexts() { static thread_local std::stack contexts; return contexts; } } // namespace LayoutContext::Provider::Provider(PtrJNodeMapVanilla* data) { getContexts().push(data); } LayoutContext::Provider::~Provider() { getContexts().pop(); } /*static*/ PtrJNodeMapVanilla* LayoutContext::getNodeMap() { return getContexts().empty() ? nullptr : getContexts().top(); } } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/LayoutContext.h ================================================ /* * 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. */ #pragma once #include #include "YGJTypesVanilla.h" namespace facebook::yoga::vanillajni { // TODO: This should not be exported or used outside of the JNI bindings class YG_EXPORT LayoutContext { public: // Sets a context on the current thread for the duration of the Provider's // lifetime. This context should be set during the layout process to allow // layout callbacks to access context-data specific to the layout pass. struct Provider { explicit Provider(PtrJNodeMapVanilla* data); ~Provider(); }; static PtrJNodeMapVanilla* getNodeMap(); }; } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/ScopedGlobalRef.h ================================================ /* * 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. */ #pragma once #include #include #include #include "corefunctions.h" namespace facebook::yoga::vanillajni { /** * ScopedGlobalRef is a sort of smart reference that allows us to control the * lifespan of a JNI global reference. * * This class is designed so that when a ScopedGlobalRef goes out of scoped, its * destructor will delete -JNIEnv->DeleteGlobalRef()- the underlying JNI * reference. * * This class should be used to wrap all the global references we create during * normal JNI operations if we want reference to eventually go away (in JNI it * is a common operation to cache some global references throughout the lifespan * of a process, in which case using this class does not really make sense). The * idea behind this is that in JNI we should be very explicit about the lifespan * of global references. Global references can quickly get out of control if not * freed properly, and the developer should always be very aware of the lifespan * of each global reference that is created in JNI so that leaks are prevented. * * This class is very explicit in its behavior, and it does not allow to perform * unexpected conversions or unexpected ownership transfer. In practice, this * class acts as a unique pointer where the underlying JNI reference can have * one and just one owner. Transferring ownership is allowed but it is an * explicit operation (implemented via move semantics and also via explicitly * API calls). * * Note that this class doesn't receive an explicit JNIEnv at construction time. * At destruction time it uses vanillajni::getCurrentEnv() to retrieve the * JNIEnv. * * It is OK to cache a ScopedGlobalRef between different JNI native * method calls. */ template class ScopedGlobalRef { static_assert( std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same(), "ScopedGlobalRef instantiated for invalid type"); public: /** * Constructs a ScopedGlobalRef with a JNI global reference. * * @param globalRef the global reference to wrap. Can be NULL. */ explicit ScopedGlobalRef(T globalRef) : mGlobalRef(globalRef) {} /** * Equivalent to ScopedGlobalRef(NULL) */ explicit ScopedGlobalRef() : mGlobalRef(NULL) {} /** * Move construction is allowed. */ ScopedGlobalRef(ScopedGlobalRef&& s) noexcept : mGlobalRef(s.release()) {} /** * Move assignment is allowed. */ ScopedGlobalRef& operator=(ScopedGlobalRef&& s) noexcept { reset(s.release()); return *this; } ~ScopedGlobalRef() { reset(); } /** * Deletes the currently held reference and reassigns a new one to the * ScopedGlobalRef. */ void reset(T ptr = NULL) { if (ptr != mGlobalRef) { if (mGlobalRef != NULL) { vanillajni::getCurrentEnv()->DeleteGlobalRef(mGlobalRef); } mGlobalRef = ptr; } } /** * Makes this ScopedGlobalRef not own the underlying JNI global reference. * After calling this method, the ScopedGlobalRef will not delete the JNI * global reference when the ScopedGlobalRef goes out of scope. */ T release() { T globalRef = mGlobalRef; mGlobalRef = NULL; return globalRef; } /** * Returns the underlying JNI global reference. */ T get() const { return mGlobalRef; } /** * Returns true if the underlying JNI reference is not NULL. */ operator bool() const { return mGlobalRef != NULL; } ScopedGlobalRef(const ScopedGlobalRef& ref) = delete; ScopedGlobalRef& operator=(const ScopedGlobalRef& other) = delete; private: T mGlobalRef; }; template ScopedGlobalRef make_global_ref(T globalRef) { return ScopedGlobalRef(globalRef); } } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/ScopedLocalRef.h ================================================ /* * 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. */ /** * This is a modified version of Android's ScopedLocalRef class that can be * found in the Android's JNI code. */ #pragma once #include #include #include namespace facebook::yoga::vanillajni { /** * ScopedLocalRef is a sort of smart reference that allows us to control the * lifespan of a JNI local reference. * * This class is designed so that when a ScopedLocalRef goes out of scope, its * destructor will delete -JNIEnv->DeleteLocalRef()- the underlying JNI * reference. * * This class should be used to wrap all the local references that JNI * gives us other than those that are passed to native methods at * invocation time. The idea behind this is that in JNI we should be very * explicit about the lifespan of local references. Local references can quickly * get out of control, and the developer should always be very aware of the * lifespan of each local reference that is created in JNI so that leaks are * prevented. * * This class is very explicit in its behavior, and it does not allow to perform * unexpected conversions or unexpected ownership transfer. In practice, this * class acts as a unique pointer where the underlying JNI reference can have * one and just one owner. Transferring ownership is allowed but it is an * explicit operation (implemented via move semantics and also via explicitly * API calls). * * As with standard JNI local references it is not a valid operation to keep a * reference around between different native method calls. */ template class ScopedLocalRef { static_assert( std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same() || std::is_same(), "ScopedLocalRef instantiated for invalid type"); public: /** * Constructs a ScopedLocalRef with a JNI local reference. * * @param localRef the local reference to wrap. Can be NULL. */ ScopedLocalRef(JNIEnv* env, T localRef) : mEnv(env), mLocalRef(localRef) {} /** * Equivalent to ScopedLocalRef(env, NULL) */ explicit ScopedLocalRef(JNIEnv* env) : mEnv(env), mLocalRef(NULL) {} /** * Move construction is allowed. */ ScopedLocalRef(ScopedLocalRef&& s) noexcept : mEnv(s.mEnv), mLocalRef(s.release()) {} /** * Move assignment is allowed. */ ScopedLocalRef& operator=(ScopedLocalRef&& s) noexcept { reset(s.release()); mEnv = s.mEnv; return *this; } ~ScopedLocalRef() { reset(); } /** * Deletes the currently held reference and reassigns a new one to the * ScopedLocalRef. */ void reset(T ptr = NULL) { if (ptr != mLocalRef) { if (mLocalRef != NULL) { mEnv->DeleteLocalRef(mLocalRef); } mLocalRef = ptr; } } /** * Makes this ScopedLocalRef not own the underlying JNI local reference. After * calling this method, the ScopedLocalRef will not delete the JNI local * reference when the ScopedLocalRef goes out of scope. */ T release() { T localRef = mLocalRef; mLocalRef = NULL; return localRef; } /** * Returns the underlying JNI local reference. */ T get() const { return mLocalRef; } /** * Returns true if the underlying JNI reference is not NULL. */ operator bool() const { return mLocalRef != NULL; } ScopedLocalRef(const ScopedLocalRef& ref) = delete; ScopedLocalRef& operator=(const ScopedLocalRef& other) = delete; private: JNIEnv* mEnv; T mLocalRef; }; template ScopedLocalRef make_local_ref(JNIEnv* env, T localRef) { return ScopedLocalRef(env, localRef); } } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/YGJNI.h ================================================ /* * 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. */ #include const short int LAYOUT_EDGE_SET_FLAG_INDEX = 0; const short int LAYOUT_WIDTH_INDEX = 1; const short int LAYOUT_HEIGHT_INDEX = 2; const short int LAYOUT_LEFT_INDEX = 3; const short int LAYOUT_TOP_INDEX = 4; const short int LAYOUT_DIRECTION_INDEX = 5; const short int LAYOUT_MARGIN_START_INDEX = 6; const short int LAYOUT_PADDING_START_INDEX = 10; const short int LAYOUT_BORDER_START_INDEX = 14; namespace { const int HAS_NEW_LAYOUT = 16; union YGNodeContext { int32_t edgesSet = 0; void* asVoidPtr; }; class YGNodeEdges { int32_t edges_; public: enum Edge { MARGIN = 1, PADDING = 2, BORDER = 4, }; explicit YGNodeEdges(YGNodeRef node) { auto context = YGNodeContext{}; context.asVoidPtr = YGNodeGetContext(node); edges_ = context.edgesSet; } void setOn(YGNodeRef node) { auto context = YGNodeContext{}; context.edgesSet = edges_; YGNodeSetContext(node, context.asVoidPtr); } bool has(Edge edge) { return (edges_ & edge) == edge; } YGNodeEdges& add(Edge edge) { edges_ |= edge; return *this; } int get() { return edges_; } }; struct YogaValue { static constexpr jint NAN_BYTES = 0x7fc00000; static jlong asJavaLong(const YGValue& value) { uint32_t valueBytes = 0; memcpy(&valueBytes, &value.value, sizeof valueBytes); return ((jlong)value.unit) << 32 | valueBytes; } constexpr static jlong undefinedAsJavaLong() { return ((jlong)YGUnitUndefined) << 32 | NAN_BYTES; } }; } // namespace ================================================ FILE: java/jni/YGJNIVanilla.cpp ================================================ /* * 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. */ #include "YGJNIVanilla.h" #include #include #include #include #include "LayoutContext.h" #include "YGJNI.h" #include "YGJTypesVanilla.h" #include "YogaJniException.h" #include "common.h" #include "jni.h" using namespace facebook; using namespace facebook::yoga; using namespace facebook::yoga::vanillajni; static inline ScopedLocalRef YGNodeJobject(YGNodeConstRef node) { return LayoutContext::getNodeMap()->ref(node); } static inline YGNodeRef _jlong2YGNodeRef(jlong addr) { return reinterpret_cast(static_cast(addr)); } static inline YGConfigRef _jlong2YGConfigRef(jlong addr) { return reinterpret_cast(static_cast(addr)); } static jlong jni_YGConfigNewJNI(JNIEnv* /*env*/, jobject /*obj*/) { return reinterpret_cast(YGConfigNew()); } static void jni_YGConfigFreeJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); // unique_ptr will destruct the underlying global_ref, if present. auto context = std::unique_ptr>{ static_cast*>(YGConfigGetContext(config))}; YGConfigFree(config); } static void jni_YGConfigSetExperimentalFeatureEnabledJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint feature, jboolean enabled) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetExperimentalFeatureEnabled( config, static_cast(feature), static_cast(enabled)); } static void jni_YGConfigSetUseWebDefaultsJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jboolean useWebDefaults) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetUseWebDefaults(config, static_cast(useWebDefaults)); } static void jni_YGConfigSetPointScaleFactorJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jfloat pixelsInPoint) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetPointScaleFactor(config, pixelsInPoint); } static void jni_YGConfigSetErrataJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint errata) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); YGConfigSetErrata(config, static_cast(errata)); } static jint jni_YGConfigGetErrataJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); return static_cast(YGConfigGetErrata(config)); } static jlong jni_YGNodeNewJNI(JNIEnv* /*env*/, jobject /*obj*/) { const YGNodeRef node = YGNodeNew(); YGNodeSetContext(node, YGNodeContext{}.asVoidPtr); return reinterpret_cast(node); } static jlong jni_YGNodeNewWithConfigJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong configPointer) { const YGNodeRef node = YGNodeNewWithConfig(_jlong2YGConfigRef(configPointer)); YGNodeSetContext(node, YGNodeContext{}.asVoidPtr); return reinterpret_cast(node); } static int YGJNILogFunc( const YGConfigConstRef config, const YGNodeConstRef /*node*/, YGLogLevel level, const char* format, va_list args) { va_list argsCopy; va_copy(argsCopy, args); int result = vsnprintf(nullptr, 0, format, argsCopy); std::vector buffer(1 + static_cast(result)); vsnprintf(buffer.data(), buffer.size(), format, args); auto jloggerPtr = static_cast*>(YGConfigGetContext(config)); if (jloggerPtr != nullptr) { if (*jloggerPtr) { JNIEnv* env = getCurrentEnv(); jclass cl = env->FindClass("com/facebook/yoga/YogaLogLevel"); static const jmethodID smethodId = facebook::yoga::vanillajni::getStaticMethodId( env, cl, "fromInt", "(I)Lcom/facebook/yoga/YogaLogLevel;"); ScopedLocalRef logLevel = facebook::yoga::vanillajni::callStaticObjectMethod( env, cl, smethodId, level); auto objectClass = facebook::yoga::vanillajni::make_local_ref( env, env->GetObjectClass((*jloggerPtr).get())); static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId( env, objectClass.get(), "log", "(Lcom/facebook/yoga/YogaLogLevel;Ljava/lang/String;)V"); facebook::yoga::vanillajni::callVoidMethod( env, (*jloggerPtr).get(), methodId, logLevel.get(), env->NewStringUTF(buffer.data())); } } return result; } static void jni_YGConfigSetLoggerJNI( JNIEnv* env, jobject /*obj*/, jlong nativePointer, jobject logger) { const YGConfigRef config = _jlong2YGConfigRef(nativePointer); auto context = reinterpret_cast*>(YGConfigGetContext(config)); if (logger != nullptr) { if (context == nullptr) { context = new ScopedGlobalRef(); YGConfigSetContext(config, context); } *context = newGlobalRef(env, logger); YGConfigSetLogger(config, YGJNILogFunc); } else { if (context != nullptr) { delete context; YGConfigSetContext(config, nullptr); } YGConfigSetLogger(config, nullptr); } } static void jni_YGNodeFinalizeJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { if (nativePointer == 0) { return; } const YGNodeRef node = _jlong2YGNodeRef(nativePointer); YGNodeFinalize(node); } static void jni_YGNodeResetJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); void* context = YGNodeGetContext(node); YGNodeReset(node); YGNodeSetContext(node, context); } static void jni_YGNodeInsertChildJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jlong childPointer, jint index) { YGNodeInsertChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), static_cast(index)); } static void jni_YGNodeSwapChildJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jlong childPointer, jint index) { YGNodeSwapChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), static_cast(index)); } static void jni_YGNodeSetIsReferenceBaselineJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jboolean isReferenceBaseline) { YGNodeSetIsReferenceBaseline( _jlong2YGNodeRef(nativePointer), static_cast(isReferenceBaseline)); } static jboolean jni_YGNodeIsReferenceBaselineJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { return static_cast( YGNodeIsReferenceBaseline(_jlong2YGNodeRef(nativePointer))); } static void jni_YGNodeRemoveAllChildrenJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); YGNodeRemoveAllChildren(node); } static void jni_YGNodeRemoveChildJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jlong childPointer) { YGNodeRemoveChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer)); } static void YGTransferLayoutOutputsRecursive(JNIEnv* env, jobject thiz, YGNodeRef root) { if (!YGNodeGetHasNewLayout(root)) { return; } auto obj = YGNodeJobject(root); if (!obj) { return; } auto edgesSet = YGNodeEdges{root}; bool marginFieldSet = edgesSet.has(YGNodeEdges::MARGIN); bool paddingFieldSet = edgesSet.has(YGNodeEdges::PADDING); bool borderFieldSet = edgesSet.has(YGNodeEdges::BORDER); int fieldFlags = edgesSet.get(); fieldFlags |= HAS_NEW_LAYOUT; const int arrSize = 6 + (marginFieldSet ? 4 : 0) + (paddingFieldSet ? 4 : 0) + (borderFieldSet ? 4 : 0); float arr[18]; arr[LAYOUT_EDGE_SET_FLAG_INDEX] = static_cast(fieldFlags); arr[LAYOUT_WIDTH_INDEX] = YGNodeLayoutGetWidth(root); arr[LAYOUT_HEIGHT_INDEX] = YGNodeLayoutGetHeight(root); arr[LAYOUT_LEFT_INDEX] = YGNodeLayoutGetLeft(root); arr[LAYOUT_TOP_INDEX] = YGNodeLayoutGetTop(root); arr[LAYOUT_DIRECTION_INDEX] = static_cast(YGNodeLayoutGetDirection(root)); if (marginFieldSet) { arr[LAYOUT_MARGIN_START_INDEX] = YGNodeLayoutGetMargin(root, YGEdgeLeft); arr[LAYOUT_MARGIN_START_INDEX + 1] = YGNodeLayoutGetMargin(root, YGEdgeTop); arr[LAYOUT_MARGIN_START_INDEX + 2] = YGNodeLayoutGetMargin(root, YGEdgeRight); arr[LAYOUT_MARGIN_START_INDEX + 3] = YGNodeLayoutGetMargin(root, YGEdgeBottom); } if (paddingFieldSet) { int paddingStartIndex = LAYOUT_PADDING_START_INDEX - (marginFieldSet ? 0 : 4); arr[paddingStartIndex] = YGNodeLayoutGetPadding(root, YGEdgeLeft); arr[paddingStartIndex + 1] = YGNodeLayoutGetPadding(root, YGEdgeTop); arr[paddingStartIndex + 2] = YGNodeLayoutGetPadding(root, YGEdgeRight); arr[paddingStartIndex + 3] = YGNodeLayoutGetPadding(root, YGEdgeBottom); } if (borderFieldSet) { int borderStartIndex = LAYOUT_BORDER_START_INDEX - (marginFieldSet ? 0 : 4) - (paddingFieldSet ? 0 : 4); arr[borderStartIndex] = YGNodeLayoutGetBorder(root, YGEdgeLeft); arr[borderStartIndex + 1] = YGNodeLayoutGetBorder(root, YGEdgeTop); arr[borderStartIndex + 2] = YGNodeLayoutGetBorder(root, YGEdgeRight); arr[borderStartIndex + 3] = YGNodeLayoutGetBorder(root, YGEdgeBottom); } // Create scope to make sure to release any local refs created here { // Don't change this field name without changing the name of the field in // Database.java auto objectClass = facebook::yoga::vanillajni::make_local_ref( env, env->GetObjectClass(obj.get())); static const jfieldID arrField = facebook::yoga::vanillajni::getFieldId( env, objectClass.get(), "arr", "[F"); ScopedLocalRef arrFinal = make_local_ref(env, env->NewFloatArray(arrSize)); env->SetFloatArrayRegion(arrFinal.get(), 0, arrSize, arr); env->SetObjectField(obj.get(), arrField, arrFinal.get()); } YGNodeSetHasNewLayout(root, false); for (size_t i = 0; i < YGNodeGetChildCount(root); i++) { YGTransferLayoutOutputsRecursive(env, thiz, YGNodeGetChild(root, i)); } } static void jni_YGNodeCalculateLayoutJNI( JNIEnv* env, jobject obj, jlong nativePointer, jfloat width, jfloat height, jlongArray nativePointers, jobjectArray javaNodes) { try { PtrJNodeMapVanilla* layoutContext = nullptr; auto map = PtrJNodeMapVanilla{}; if (nativePointers != nullptr) { map = PtrJNodeMapVanilla{nativePointers, javaNodes}; layoutContext = ↦ } LayoutContext::Provider contextProvider(layoutContext); const YGNodeRef root = _jlong2YGNodeRef(nativePointer); YGNodeCalculateLayout( root, static_cast(width), static_cast(height), YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer))); YGTransferLayoutOutputsRecursive(env, obj, root); } catch (const YogaJniException& jniException) { ScopedLocalRef throwable = jniException.getThrowable(); if (throwable.get() != nullptr) { env->Throw(throwable.get()); } } catch (const std::logic_error& ex) { env->ExceptionClear(); jclass cl = env->FindClass("java/lang/IllegalStateException"); static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId( env, cl, "", "(Ljava/lang/String;)V"); auto throwable = env->NewObject(cl, methodId, env->NewStringUTF(ex.what())); env->Throw(static_cast(throwable)); } } static void jni_YGNodeMarkDirtyJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { YGNodeMarkDirty(_jlong2YGNodeRef(nativePointer)); } static jboolean jni_YGNodeIsDirtyJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { return (jboolean)YGNodeIsDirty(_jlong2YGNodeRef(nativePointer)); } static void jni_YGNodeCopyStyleJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong dstNativePointer, jlong srcNativePointer) { YGNodeCopyStyle( _jlong2YGNodeRef(dstNativePointer), _jlong2YGNodeRef(srcNativePointer)); } #define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \ static javatype jni_YGNodeStyleGet##name##JNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ return (javatype)YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \ } \ \ static void jni_YGNodeStyleSet##name##JNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, javatype value) { \ YGNodeStyleSet##name( \ _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } #define YG_NODE_JNI_STYLE_UNIT_PROP(name) \ static jlong jni_YGNodeStyleGet##name##JNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ return YogaValue::asJavaLong( \ YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \ } \ \ static void jni_YGNodeStyleSet##name##JNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jfloat value) { \ YGNodeStyleSet##name( \ _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } \ \ static void jni_YGNodeStyleSet##name##PercentJNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jfloat value) { \ YGNodeStyleSet##name##Percent( \ _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } #define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \ YG_NODE_JNI_STYLE_UNIT_PROP(name) \ static void jni_YGNodeStyleSet##name##AutoJNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ 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) { \ return YogaValue::asJavaLong( \ YGNodeStyleGet##name( \ _jlong2YGNodeRef(nativePointer), static_cast(edge))); \ } \ \ static void jni_YGNodeStyleSet##name##JNI( \ JNIEnv* /*env*/, \ jobject /*obj*/, \ jlong nativePointer, \ jint edge, \ jfloat value) { \ YGNodeStyleSet##name( \ _jlong2YGNodeRef(nativePointer), \ static_cast(edge), \ static_cast(value)); \ } \ \ static void jni_YGNodeStyleSet##name##PercentJNI( \ JNIEnv* /*env*/, \ jobject /*obj*/, \ jlong nativePointer, \ jint edge, \ jfloat value) { \ YGNodeStyleSet##name##Percent( \ _jlong2YGNodeRef(nativePointer), \ static_cast(edge), \ static_cast(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(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); 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); 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_EDGE_UNIT_PROP_AUTO(Position); static jlong jni_YGNodeStyleGetMarginJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); if (!YGNodeEdges{yogaNodeRef}.has(YGNodeEdges::MARGIN)) { return YogaValue::undefinedAsJavaLong(); } return YogaValue::asJavaLong( YGNodeStyleGetMargin(yogaNodeRef, static_cast(edge))); } static void jni_YGNodeStyleSetMarginJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge, jfloat margin) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeEdges{yogaNodeRef}.add(YGNodeEdges::MARGIN).setOn(yogaNodeRef); YGNodeStyleSetMargin( yogaNodeRef, static_cast(edge), static_cast(margin)); } static void jni_YGNodeStyleSetMarginPercentJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge, jfloat percent) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeEdges{yogaNodeRef}.add(YGNodeEdges::MARGIN).setOn(yogaNodeRef); YGNodeStyleSetMarginPercent( yogaNodeRef, static_cast(edge), static_cast(percent)); } static void jni_YGNodeStyleSetMarginAutoJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeEdges{yogaNodeRef}.add(YGNodeEdges::MARGIN).setOn(yogaNodeRef); YGNodeStyleSetMarginAuto(yogaNodeRef, static_cast(edge)); } static jlong jni_YGNodeStyleGetPaddingJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); if (!YGNodeEdges{yogaNodeRef}.has(YGNodeEdges::PADDING)) { return YogaValue::undefinedAsJavaLong(); } return YogaValue::asJavaLong( YGNodeStyleGetPadding(yogaNodeRef, static_cast(edge))); } static void jni_YGNodeStyleSetPaddingJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge, jfloat padding) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeEdges{yogaNodeRef}.add(YGNodeEdges::PADDING).setOn(yogaNodeRef); YGNodeStyleSetPadding( yogaNodeRef, static_cast(edge), static_cast(padding)); } static void jni_YGNodeStyleSetPaddingPercentJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge, jfloat percent) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeEdges{yogaNodeRef}.add(YGNodeEdges::PADDING).setOn(yogaNodeRef); YGNodeStyleSetPaddingPercent( yogaNodeRef, static_cast(edge), static_cast(percent)); } static jfloat jni_YGNodeStyleGetBorderJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); if (!YGNodeEdges{yogaNodeRef}.has(YGNodeEdges::BORDER)) { return (jfloat)YGUndefined; } return (jfloat)YGNodeStyleGetBorder(yogaNodeRef, static_cast(edge)); } static void jni_YGNodeStyleSetBorderJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge, jfloat border) { YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeEdges{yogaNodeRef}.add(YGNodeEdges::BORDER).setOn(yogaNodeRef); YGNodeStyleSetBorder( yogaNodeRef, static_cast(edge), static_cast(border)); } static void YGTransferLayoutDirection(YGNodeConstRef node, jobject javaNode) { // Don't change this field name without changing the name of the field in // Database.java JNIEnv* env = getCurrentEnv(); auto objectClass = facebook::yoga::vanillajni::make_local_ref( env, env->GetObjectClass(javaNode)); static const jfieldID layoutDirectionField = facebook::yoga::vanillajni::getFieldId( env, objectClass.get(), "mLayoutDirection", "I"); env->SetIntField( javaNode, layoutDirectionField, static_cast(YGNodeLayoutGetDirection(node))); } static YGSize YGJNIMeasureFunc( YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) { if (auto obj = YGNodeJobject(node)) { YGTransferLayoutDirection(node, obj.get()); JNIEnv* env = getCurrentEnv(); auto objectClass = facebook::yoga::vanillajni::make_local_ref( env, env->GetObjectClass(obj.get())); static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId( env, objectClass.get(), "measure", "(FIFI)J"); const auto measureResult = facebook::yoga::vanillajni::callLongMethod( env, obj.get(), methodId, width, widthMode, height, heightMode); static_assert( sizeof(measureResult) == 8, "Expected measureResult to be 8 bytes, or two 32 bit ints"); uint32_t wBits = 0xFFFFFFFF & (measureResult >> 32); uint32_t hBits = 0xFFFFFFFF & measureResult; auto measuredWidth = std::bit_cast(wBits); auto measuredHeight = std::bit_cast(hBits); return YGSize{measuredWidth, measuredHeight}; } else { return YGSize{ widthMode == YGMeasureModeUndefined ? 0 : width, heightMode == YGMeasureModeUndefined ? 0 : height, }; } } static void jni_YGNodeSetHasMeasureFuncJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jboolean hasMeasureFunc) { YGNodeSetMeasureFunc( _jlong2YGNodeRef(nativePointer), static_cast(hasMeasureFunc) ? YGJNIMeasureFunc : nullptr); } static float YGJNIBaselineFunc(YGNodeConstRef node, float width, float height) { if (auto obj = YGNodeJobject(node)) { JNIEnv* env = getCurrentEnv(); auto objectClass = facebook::yoga::vanillajni::make_local_ref( env, env->GetObjectClass(obj.get())); static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId( env, objectClass.get(), "baseline", "(FF)F"); return facebook::yoga::vanillajni::callFloatMethod( env, obj.get(), methodId, width, height); } else { return height; } } static void jni_YGNodeSetHasBaselineFuncJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jboolean hasBaselineFunc) { YGNodeSetBaselineFunc( _jlong2YGNodeRef(nativePointer), static_cast(hasBaselineFunc) ? YGJNIBaselineFunc : nullptr); } static void jni_YGNodeSetAlwaysFormsContainingBlockJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jboolean alwaysFormsContainingBlock) { YGNodeSetAlwaysFormsContainingBlock( _jlong2YGNodeRef(nativePointer), static_cast(alwaysFormsContainingBlock)); } static jlong jni_YGNodeCloneJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { auto node = _jlong2YGNodeRef(nativePointer); const YGNodeRef clonedYogaNode = YGNodeClone(node); YGNodeSetContext(clonedYogaNode, YGNodeGetContext(node)); return reinterpret_cast(clonedYogaNode); } static jlong jni_YGNodeStyleGetGapJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint gutter) { return YogaValue::asJavaLong(YGNodeStyleGetGap( _jlong2YGNodeRef(nativePointer), static_cast(gutter))); } static void jni_YGNodeStyleSetGapJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint gutter, jfloat gapLength) { YGNodeStyleSetGap( _jlong2YGNodeRef(nativePointer), static_cast(gutter), static_cast(gapLength)); } static void jni_YGNodeStyleSetGapPercentJNI( JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint gutter, jfloat gapLength) { YGNodeStyleSetGapPercent( _jlong2YGNodeRef(nativePointer), static_cast(gutter), static_cast(gapLength)); } // Yoga specific properties, not compatible with flexbox specification YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio); static JNINativeMethod methods[] = { {"jni_YGConfigNewJNI", "()J", (void*)jni_YGConfigNewJNI}, {"jni_YGConfigFreeJNI", "(J)V", (void*)jni_YGConfigFreeJNI}, {"jni_YGConfigSetExperimentalFeatureEnabledJNI", "(JIZ)V", (void*)jni_YGConfigSetExperimentalFeatureEnabledJNI}, {"jni_YGConfigSetUseWebDefaultsJNI", "(JZ)V", (void*)jni_YGConfigSetUseWebDefaultsJNI}, {"jni_YGConfigSetPointScaleFactorJNI", "(JF)V", (void*)jni_YGConfigSetPointScaleFactorJNI}, {"jni_YGConfigSetErrataJNI", "(JI)V", (void*)jni_YGConfigSetErrataJNI}, {"jni_YGConfigGetErrataJNI", "(J)I", (void*)jni_YGConfigGetErrataJNI}, {"jni_YGConfigSetLoggerJNI", "(JLcom/facebook/yoga/YogaLogger;)V", (void*)jni_YGConfigSetLoggerJNI}, {"jni_YGNodeNewJNI", "()J", (void*)jni_YGNodeNewJNI}, {"jni_YGNodeNewWithConfigJNI", "(J)J", (void*)jni_YGNodeNewWithConfigJNI}, {"jni_YGNodeFinalizeJNI", "(J)V", (void*)jni_YGNodeFinalizeJNI}, {"jni_YGNodeResetJNI", "(J)V", (void*)jni_YGNodeResetJNI}, {"jni_YGNodeInsertChildJNI", "(JJI)V", (void*)jni_YGNodeInsertChildJNI}, {"jni_YGNodeSwapChildJNI", "(JJI)V", (void*)jni_YGNodeSwapChildJNI}, {"jni_YGNodeSetIsReferenceBaselineJNI", "(JZ)V", (void*)jni_YGNodeSetIsReferenceBaselineJNI}, {"jni_YGNodeIsReferenceBaselineJNI", "(J)Z", (void*)jni_YGNodeIsReferenceBaselineJNI}, {"jni_YGNodeRemoveAllChildrenJNI", "(J)V", (void*)jni_YGNodeRemoveAllChildrenJNI}, {"jni_YGNodeRemoveChildJNI", "(JJ)V", (void*)jni_YGNodeRemoveChildJNI}, {"jni_YGNodeCalculateLayoutJNI", "(JFF[J[Lcom/facebook/yoga/YogaNodeJNIBase;)V", (void*)jni_YGNodeCalculateLayoutJNI}, {"jni_YGNodeMarkDirtyJNI", "(J)V", (void*)jni_YGNodeMarkDirtyJNI}, {"jni_YGNodeIsDirtyJNI", "(J)Z", (void*)jni_YGNodeIsDirtyJNI}, {"jni_YGNodeCopyStyleJNI", "(JJ)V", (void*)jni_YGNodeCopyStyleJNI}, {"jni_YGNodeStyleGetDirectionJNI", "(J)I", (void*)jni_YGNodeStyleGetDirectionJNI}, {"jni_YGNodeStyleSetDirectionJNI", "(JI)V", (void*)jni_YGNodeStyleSetDirectionJNI}, {"jni_YGNodeStyleGetFlexDirectionJNI", "(J)I", (void*)jni_YGNodeStyleGetFlexDirectionJNI}, {"jni_YGNodeStyleSetFlexDirectionJNI", "(JI)V", (void*)jni_YGNodeStyleSetFlexDirectionJNI}, {"jni_YGNodeStyleGetJustifyContentJNI", "(J)I", (void*)jni_YGNodeStyleGetJustifyContentJNI}, {"jni_YGNodeStyleSetJustifyContentJNI", "(JI)V", (void*)jni_YGNodeStyleSetJustifyContentJNI}, {"jni_YGNodeStyleGetAlignItemsJNI", "(J)I", (void*)jni_YGNodeStyleGetAlignItemsJNI}, {"jni_YGNodeStyleSetAlignItemsJNI", "(JI)V", (void*)jni_YGNodeStyleSetAlignItemsJNI}, {"jni_YGNodeStyleGetAlignSelfJNI", "(J)I", (void*)jni_YGNodeStyleGetAlignSelfJNI}, {"jni_YGNodeStyleSetAlignSelfJNI", "(JI)V", (void*)jni_YGNodeStyleSetAlignSelfJNI}, {"jni_YGNodeStyleGetAlignContentJNI", "(J)I", (void*)jni_YGNodeStyleGetAlignContentJNI}, {"jni_YGNodeStyleSetAlignContentJNI", "(JI)V", (void*)jni_YGNodeStyleSetAlignContentJNI}, {"jni_YGNodeStyleGetPositionTypeJNI", "(J)I", (void*)jni_YGNodeStyleGetPositionTypeJNI}, {"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}, {"jni_YGNodeStyleSetFlexWrapJNI", "(JI)V", (void*)jni_YGNodeStyleSetFlexWrapJNI}, {"jni_YGNodeStyleGetOverflowJNI", "(J)I", (void*)jni_YGNodeStyleGetOverflowJNI}, {"jni_YGNodeStyleSetOverflowJNI", "(JI)V", (void*)jni_YGNodeStyleSetOverflowJNI}, {"jni_YGNodeStyleGetDisplayJNI", "(J)I", (void*)jni_YGNodeStyleGetDisplayJNI}, {"jni_YGNodeStyleSetDisplayJNI", "(JI)V", (void*)jni_YGNodeStyleSetDisplayJNI}, {"jni_YGNodeStyleGetFlexJNI", "(J)F", (void*)jni_YGNodeStyleGetFlexJNI}, {"jni_YGNodeStyleSetFlexJNI", "(JF)V", (void*)jni_YGNodeStyleSetFlexJNI}, {"jni_YGNodeStyleGetFlexGrowJNI", "(J)F", (void*)jni_YGNodeStyleGetFlexGrowJNI}, {"jni_YGNodeStyleSetFlexGrowJNI", "(JF)V", (void*)jni_YGNodeStyleSetFlexGrowJNI}, {"jni_YGNodeStyleGetFlexShrinkJNI", "(J)F", (void*)jni_YGNodeStyleGetFlexShrinkJNI}, {"jni_YGNodeStyleSetFlexShrinkJNI", "(JF)V", (void*)jni_YGNodeStyleSetFlexShrinkJNI}, {"jni_YGNodeStyleGetFlexBasisJNI", "(J)J", (void*)jni_YGNodeStyleGetFlexBasisJNI}, {"jni_YGNodeStyleSetFlexBasisJNI", "(JF)V", (void*)jni_YGNodeStyleSetFlexBasisJNI}, {"jni_YGNodeStyleSetFlexBasisPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetFlexBasisPercentJNI}, {"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}, {"jni_YGNodeStyleSetMarginJNI", "(JIF)V", (void*)jni_YGNodeStyleSetMarginJNI}, {"jni_YGNodeStyleSetMarginPercentJNI", "(JIF)V", (void*)jni_YGNodeStyleSetMarginPercentJNI}, {"jni_YGNodeStyleSetMarginAutoJNI", "(JI)V", (void*)jni_YGNodeStyleSetMarginAutoJNI}, {"jni_YGNodeStyleGetPaddingJNI", "(JI)J", (void*)jni_YGNodeStyleGetPaddingJNI}, {"jni_YGNodeStyleSetPaddingJNI", "(JIF)V", (void*)jni_YGNodeStyleSetPaddingJNI}, {"jni_YGNodeStyleSetPaddingPercentJNI", "(JIF)V", (void*)jni_YGNodeStyleSetPaddingPercentJNI}, {"jni_YGNodeStyleGetBorderJNI", "(JI)F", (void*)jni_YGNodeStyleGetBorderJNI}, {"jni_YGNodeStyleSetBorderJNI", "(JIF)V", (void*)jni_YGNodeStyleSetBorderJNI}, {"jni_YGNodeStyleGetPositionJNI", "(JI)J", (void*)jni_YGNodeStyleGetPositionJNI}, {"jni_YGNodeStyleSetPositionJNI", "(JIF)V", (void*)jni_YGNodeStyleSetPositionJNI}, {"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", "(JF)V", (void*)jni_YGNodeStyleSetWidthPercentJNI}, {"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", (void*)jni_YGNodeStyleSetHeightJNI}, {"jni_YGNodeStyleSetHeightPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetHeightPercentJNI}, {"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}, {"jni_YGNodeStyleSetMinWidthJNI", "(JF)V", (void*)jni_YGNodeStyleSetMinWidthJNI}, {"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}, {"jni_YGNodeStyleSetMinHeightJNI", "(JF)V", (void*)jni_YGNodeStyleSetMinHeightJNI}, {"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}, {"jni_YGNodeStyleSetMaxWidthJNI", "(JF)V", (void*)jni_YGNodeStyleSetMaxWidthJNI}, {"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}, {"jni_YGNodeStyleSetMaxHeightJNI", "(JF)V", (void*)jni_YGNodeStyleSetMaxHeightJNI}, {"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}, {"jni_YGNodeStyleSetAspectRatioJNI", "(JF)V", (void*)jni_YGNodeStyleSetAspectRatioJNI}, {"jni_YGNodeSetHasMeasureFuncJNI", "(JZ)V", (void*)jni_YGNodeSetHasMeasureFuncJNI}, {"jni_YGNodeStyleGetGapJNI", "(JI)J", (void*)jni_YGNodeStyleGetGapJNI}, {"jni_YGNodeStyleSetGapJNI", "(JIF)V", (void*)jni_YGNodeStyleSetGapJNI}, {"jni_YGNodeStyleSetGapPercentJNI", "(JIF)V", (void*)jni_YGNodeStyleSetGapPercentJNI}, {"jni_YGNodeSetHasBaselineFuncJNI", "(JZ)V", (void*)jni_YGNodeSetHasBaselineFuncJNI}, {"jni_YGNodeSetAlwaysFormsContainingBlockJNI", "(JZ)V", (void*)jni_YGNodeSetAlwaysFormsContainingBlockJNI}, {"jni_YGNodeCloneJNI", "(J)J", (void*)jni_YGNodeCloneJNI}, }; void YGJNIVanilla::registerNatives(JNIEnv* env) { facebook::yoga::vanillajni::registerNatives( env, "com/facebook/yoga/YogaNative", methods, sizeof(methods) / sizeof(JNINativeMethod)); } ================================================ FILE: java/jni/YGJNIVanilla.h ================================================ /* * 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. */ #include "jni.h" namespace YGJNIVanilla { void registerNatives(JNIEnv* env); }; ================================================ FILE: java/jni/YGJTypesVanilla.h ================================================ /* * 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. */ #pragma once #include #include #include #include "common.h" #include "jni.h" class PtrJNodeMapVanilla { std::map ptrsToIdxs_{}; jobjectArray javaNodes_{}; public: PtrJNodeMapVanilla() = default; PtrJNodeMapVanilla(jlongArray javaNativePointers, jobjectArray javaNodes) : javaNodes_{javaNodes} { using namespace facebook::yoga::vanillajni; JNIEnv* env = getCurrentEnv(); jsize nativePointersSize = env->GetArrayLength(javaNativePointers); std::vector nativePointers(static_cast(nativePointersSize)); env->GetLongArrayRegion( javaNativePointers, 0, nativePointersSize, nativePointers.data()); for (jsize i = 0; i < nativePointersSize; ++i) { ptrsToIdxs_[(YGNodeConstRef)nativePointers[static_cast(i)]] = i; } } facebook::yoga::vanillajni::ScopedLocalRef ref(YGNodeConstRef node) { using namespace facebook::yoga::vanillajni; JNIEnv* env = getCurrentEnv(); auto idx = ptrsToIdxs_.find(node); if (idx == ptrsToIdxs_.end()) { return ScopedLocalRef(env); } else { return make_local_ref( env, env->GetObjectArrayElement(javaNodes_, idx->second)); } } }; ================================================ FILE: java/jni/YogaJniException.cpp ================================================ /* * 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. */ #include "YogaJniException.h" #include #include #include "common.h" namespace facebook::yoga::vanillajni { YogaJniException::YogaJniException() { jclass cl = getCurrentEnv()->FindClass("java/lang/RuntimeException"); static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId( getCurrentEnv(), cl, "", "()V"); auto throwable = getCurrentEnv()->NewObject(cl, methodId); throwable_ = newGlobalRef(getCurrentEnv(), static_cast(throwable)); } YogaJniException::YogaJniException(jthrowable throwable) { throwable_ = newGlobalRef(getCurrentEnv(), throwable); } YogaJniException::YogaJniException(YogaJniException&& rhs) noexcept : throwable_(std::move(rhs.throwable_)) {} YogaJniException::YogaJniException(const YogaJniException& rhs) { throwable_ = newGlobalRef(getCurrentEnv(), rhs.throwable_.get()); } YogaJniException::~YogaJniException() { try { throwable_.reset(); } catch (...) { std::terminate(); } } ScopedLocalRef YogaJniException::getThrowable() const noexcept { return make_local_ref( getCurrentEnv(), static_cast(getCurrentEnv()->NewLocalRef(throwable_.get()))); } } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/YogaJniException.h ================================================ /* * 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. */ #include #include #include "common.h" namespace facebook::yoga::vanillajni { /** * This class wraps a Java exception (jthrowable) into a C++ exception; A global * reference to Java exception (jthrowable) is made so that the exception object * does not gets cleared before jni call completion */ class YogaJniException : public std::exception { public: YogaJniException(); ~YogaJniException() override; explicit YogaJniException(jthrowable throwable); YogaJniException(YogaJniException&& rhs) noexcept; YogaJniException(const YogaJniException& rhs); ScopedLocalRef getThrowable() const noexcept; private: ScopedGlobalRef throwable_; }; } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/common.cpp ================================================ /* * 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. */ #include "common.h" namespace facebook::yoga::vanillajni { void registerNatives( JNIEnv* env, const char* className, const JNINativeMethod methods[], size_t numMethods) { jclass clazz = env->FindClass(className); assertNoPendingJniExceptionIf(env, clazz == nullptr); auto result = env->RegisterNatives(clazz, methods, static_cast(numMethods)); assertNoPendingJniExceptionIf(env, result != JNI_OK); } jmethodID getStaticMethodId( JNIEnv* env, jclass clazz, const char* methodName, const char* methodDescriptor) { jmethodID methodId = env->GetStaticMethodID(clazz, methodName, methodDescriptor); assertNoPendingJniExceptionIf(env, methodId == nullptr); return methodId; } jmethodID getMethodId( JNIEnv* env, jclass clazz, const char* methodName, const char* methodDescriptor) { jmethodID methodId = env->GetMethodID(clazz, methodName, methodDescriptor); assertNoPendingJniExceptionIf(env, methodId == nullptr); return methodId; } jfieldID getFieldId( JNIEnv* env, jclass clazz, const char* fieldName, const char* fieldSignature) { jfieldID fieldId = env->GetFieldID(clazz, fieldName, fieldSignature); assertNoPendingJniExceptionIf(env, fieldId == nullptr); return fieldId; } #define DEFINE_CALL_METHOD_FOR_PRIMITIVE_IMPLEMENTATION(jnitype, readableType) \ DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(jnitype, readableType) { \ va_list args; \ va_start(args, methodId); \ jnitype result = env->Call##readableType##MethodV(obj, methodId, args); \ va_end(args); \ assertNoPendingJniException(env); \ return result; \ } DEFINE_CALL_METHOD_FOR_PRIMITIVE_IMPLEMENTATION(jlong, Long); DEFINE_CALL_METHOD_FOR_PRIMITIVE_IMPLEMENTATION(jfloat, Float); DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(void, Void) { va_list args; va_start(args, methodId); env->CallVoidMethodV(obj, methodId, args); va_end(args); assertNoPendingJniException(env); } ScopedLocalRef callStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID methodId, ...) { va_list args; va_start(args, methodId); jobject result = env->CallStaticObjectMethodV(clazz, methodId, args); va_end(args); assertNoPendingJniExceptionIf(env, result == nullptr); return make_local_ref(env, result); } ScopedGlobalRef newGlobalRef(JNIEnv* env, jobject obj) { jobject result = env->NewGlobalRef(obj); if (result == nullptr) { logErrorMessageAndDie("Could not obtain global reference from object"); } return make_global_ref(result); } ScopedGlobalRef newGlobalRef(JNIEnv* env, jthrowable obj) { auto result = static_cast(env->NewGlobalRef(obj)); if (result == nullptr) { logErrorMessageAndDie("Could not obtain global reference from object"); } return make_global_ref(result); } } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/common.h ================================================ /* * 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. */ #pragma once #include "ScopedGlobalRef.h" #include "ScopedLocalRef.h" namespace facebook::yoga::vanillajni { /** * Registers a set of methods for a JNI class. Aborts if registration fails. */ void registerNatives( JNIEnv* env, const char* className, const JNINativeMethod methods[], size_t numMethods); /** * Returns a jmethodID for a class static method. Aborts if any error happens. */ jmethodID getStaticMethodId( JNIEnv* env, jclass clazz, const char* methodName, const char* methodDescriptor); /** * Returns a jmethodID for a class non-static method. Aborts if any error * happens. */ jmethodID getMethodId( JNIEnv* env, jclass clazz, const char* methodName, const char* methodDescriptor); /** * Returns a class non-static field ID. Aborts if any error happens. */ jfieldID getFieldId( JNIEnv* env, jclass clazz, const char* fieldName, const char* fieldSignature); // Helper methods to call a non-static method on an object depending on the // return type. Each method will abort the execution if an error // (such as a Java pending exception) is detected after invoking the // Java method. #define DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(jnitype, readableType) \ jnitype call##readableType##Method( \ JNIEnv* env, jobject obj, jmethodID methodId, ...) DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(void, Void); DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(jlong, Long); DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(jfloat, Float); ScopedLocalRef callStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID methodId, ...); /** * Given a local or a global reference, this method creates a new global * reference out of it. If any error happens, aborts the process. */ ScopedGlobalRef newGlobalRef(JNIEnv* env, jobject obj); ScopedGlobalRef newGlobalRef(JNIEnv* env, jthrowable obj); } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/corefunctions.cpp ================================================ /* * 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. */ #include "corefunctions.h" #include "YogaJniException.h" #include "macros.h" namespace facebook::yoga::vanillajni { namespace { JavaVM* globalVm = nullptr; struct JavaVMInitializer { explicit JavaVMInitializer(JavaVM* vm) { if (!vm) { logErrorMessageAndDie( "You cannot pass a NULL JavaVM to ensureInitialized"); } globalVm = vm; } }; } // namespace jint ensureInitialized(JNIEnv** env, JavaVM* vm) { static JavaVMInitializer init(vm); if (env == nullptr) { logErrorMessageAndDie( "Need to pass a valid JNIEnv pointer to vanillajni initialization " "routine"); } if (vm->GetEnv(reinterpret_cast(env), JNI_VERSION_1_6) != JNI_OK) { logErrorMessageAndDie( "Error retrieving JNIEnv during initialization of vanillajni"); } return JNI_VERSION_1_6; } // TODO why we need JNIEXPORT for getCurrentEnv ? JNIEXPORT JNIEnv* getCurrentEnv() { JNIEnv* env = nullptr; jint ret = globalVm->GetEnv((void**)&env, JNI_VERSION_1_6); if (ret != JNI_OK) { logErrorMessageAndDie( "There was an error retrieving the current JNIEnv. Make sure the " "current thread is attached"); } return env; } void logErrorMessageAndDie(const char* message) { (void)message; VANILLAJNI_LOG_ERROR( "VanillaJni", "Aborting due to error detected in native code: %s", message); VANILLAJNI_DIE(); } void assertNoPendingJniException(JNIEnv* env) { if (env->ExceptionCheck() == JNI_FALSE) { return; } auto throwable = env->ExceptionOccurred(); if (throwable == nullptr) { logErrorMessageAndDie("Unable to get pending JNI exception."); } env->ExceptionClear(); throw YogaJniException(throwable); } void assertNoPendingJniExceptionIf(JNIEnv* env, bool condition) { if (!condition) { return; } if (env->ExceptionCheck() == JNI_TRUE) { assertNoPendingJniException(env); return; } throw YogaJniException(); } } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/corefunctions.h ================================================ /* * 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. */ #pragma once #include #include namespace facebook::yoga::vanillajni { /** * This method has to be called before using the vanillajni library. This method * is typically called when doing initialization in the "on load" JNI hook of a * particular library. * * This method is thread safe, and after the first time it's called it has no * initialization effect. * * @param env use this output parameter to get a JNIEnv to use for things such * as registering native methods and such. * @param vm the VM instance passed by JNI. This is usually the VM instance * that is passed to the "on load" JNI hook. * @return an integer value to return from the "on load" hook. */ jint ensureInitialized(JNIEnv** env, JavaVM* vm); /** * Returns a JNIEnv* suitable for the current thread. If the current thread is * not attached to the Java VM, this method aborts execution. */ JNIEnv* getCurrentEnv(); /** * Logs an error message and aborts the current process. */ void logErrorMessageAndDie(const char* message); /** * Checks whether there is a pending JNI exception. If so, it logs an error * message and aborts the current process. Otherwise it does nothing. */ void assertNoPendingJniException(JNIEnv* env); void assertNoPendingJniExceptionIf(JNIEnv* env, bool condition); } // namespace facebook::yoga::vanillajni ================================================ FILE: java/jni/macros.h ================================================ /* * 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. */ #pragma once #include #ifdef __ANDROID__ #include #endif #ifdef __ANDROID__ #define VANILLAJNI_LOG_ERROR(tag, format, ...) \ __android_log_print(ANDROID_LOG_ERROR, tag, format, ##__VA_ARGS__) #else #define VANILLAJNI_LOG_ERROR(tag, format, ...) #endif #define VANILLAJNI_DIE() std::abort() ================================================ FILE: java/jni/yogajni.cpp ================================================ /* * 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. */ #include "YGJNIVanilla.h" #include "common.h" using namespace facebook::yoga; jint JNI_OnLoad(JavaVM* vm, void* /*unused*/) { JNIEnv* env = nullptr; jint ret = vanillajni::ensureInitialized(&env, vm); YGJNIVanilla::registerNatives(env); return ret; } ================================================ FILE: java/proguard-rules.pro ================================================ # 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. -keep,allowobfuscation @interface com.facebook.yoga.annotations.DoNotStrip -keep @com.facebook.yoga.annotations.DoNotStrip class * -keepclassmembers class * { @com.facebook.yoga.annotations.DoNotStrip *; } ================================================ FILE: java/res/values/strings.xml ================================================ Yoga ================================================ FILE: java/tests/com/facebook/yoga/TestParametrization.java ================================================ /* * 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 java.util.Arrays; import java.util.List; public class TestParametrization { public static Iterable nodeFactories() { NodeFactory nodeFactory = new NodeFactory() { @Override public YogaNode create() { return YogaNodeFactory.create(); } @Override public YogaNode create(YogaConfig config) { return YogaNodeFactory.create(config); } @Override public String toString() { return "JNI"; } }; return Arrays.asList(nodeFactory); } public interface NodeFactory { YogaNode create(); YogaNode create(YogaConfig config); } } ================================================ FILE: java/tests/com/facebook/yoga/YGAlignBaselineTest.java ================================================ /* * 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 static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class YGAlignBaselineTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; private YogaBaselineFunction getBaselineFunc() { return new YogaBaselineFunction() { @Override public float baseline(YogaNode node, float width, float height) { return height / 2; } }; } @Test public void test_align_baseline_parent_using_child_in_column_as_reference() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createYGNode(config, YogaFlexDirection.ROW, 1000f, 1000f, true); final YogaNode root_child0 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 600f, false); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 800f, false); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 300f, false); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 400f, false); root_child1_child1.setBaselineFunction(getBaselineFunc()); root_child1_child1.setIsReferenceBaseline(true); root_child1.addChildAt(root_child1_child1, 1); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(300f, root_child1_child1.getLayoutY(), 0.0f); } @Test public void test_align_baseline_parent_using_child_in_row_as_reference() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createYGNode(config, YogaFlexDirection.ROW, 1000f, 1000f, true); final YogaNode root_child0 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 600f, false); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createYGNode(config, YogaFlexDirection.ROW, 500f, 800f, true); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 500f, false); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createYGNode(config, YogaFlexDirection.COLUMN, 500f, 400f, false); root_child1_child1.setBaselineFunction(getBaselineFunc()); root_child1_child1.setIsReferenceBaseline(true); root_child1.addChildAt(root_child1_child1, 1); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(300f, root_child1_child1.getLayoutY(), 0.0f); } private YogaNode createYGNode( YogaConfig config, YogaFlexDirection flexDirection, float width, float height, boolean alignBaseline) { YogaNode node = mNodeFactory.create(config); node.setFlexDirection(flexDirection); node.setWidth(width); node.setHeight(height); if (alignBaseline) { node.setAlignItems(YogaAlign.BASELINE); } return node; } } ================================================ FILE: java/tests/com/facebook/yoga/YogaExceptionTest.java ================================================ /* * 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 static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class YogaExceptionTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test(expected = RuntimeException.class) public void testBaselineThrows() { final YogaNode root = createNode(); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode child1 = createNode(); root.addChildAt(child1, 0); final YogaNode child2 = createNode(); child2.setBaselineFunction(new YogaBaselineFunction() { public float baseline(YogaNode node, float width, float height) { throw new RuntimeException(); } }); root.addChildAt(child2, 1); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); } @Test public void testBaselineThrowsAndStops() { final YogaNode root = createNode(); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode child1 = createNode(); root.addChildAt(child1, 0); final YogaNode child2 = createNode(); final AtomicReference expected = new AtomicReference(); child2.setBaselineFunction(new YogaBaselineFunction() { public float baseline(YogaNode node, float width, float height) { RuntimeException e = new RuntimeException(); expected.set(e); throw e; } }); root.addChildAt(child2, 1); final YogaNode child3 = createNode(); final AtomicBoolean child3Called = new AtomicBoolean(); child3.setBaselineFunction(new YogaBaselineFunction() { public float baseline(YogaNode node, float width, float height) { child3Called.set(true); return 1.0f; } }); root.addChildAt(child3, 2); try { root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); fail(); } catch (RuntimeException e) { assertEquals(expected.get(), e); } assertFalse(child3Called.get()); } @Test(expected = RuntimeException.class) public void testMeasureThrows() { final YogaNode node = createNode(); node.setMeasureFunction(new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { throw new RuntimeException(); } }); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); } @Test public void testMeasureThrowsAndStops() { final YogaNode root = createNode(); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode child1 = createNode(); root.addChildAt(child1, 0); final YogaNode child2 = createNode(); final AtomicReference expected = new AtomicReference(); child2.setMeasureFunction(new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { RuntimeException e = new RuntimeException(); expected.set(e); throw e; } }); root.addChildAt(child2, 1); final YogaNode child3 = createNode(); final AtomicBoolean child3Called = new AtomicBoolean(); child3.setMeasureFunction(new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { child3Called.set(true); return 1; } }); root.addChildAt(child3, 2); try { root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); fail(); } catch (RuntimeException e) { assertEquals(expected.get(), e); } assertFalse(child3Called.get()); } private YogaNode createNode() { return mNodeFactory.create(); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/com/facebook/yoga/YogaLoggerTest.java ================================================ /* * 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 org.junit.Test; import java.lang.ref.WeakReference; import java.util.List; import java.util.ArrayList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; public class YogaLoggerTest { @Test public void testRemovingLoggerFromConfig() throws Exception { final List logs = new ArrayList<>(); final YogaConfig config = YogaConfigFactory.create(); YogaLogger logger = new YogaLogger() { @Override public void log(YogaLogLevel level, String message) { logs.add(message); } }; config.setLogger(logger); final YogaNode root = YogaNodeFactory.create(config); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode child1 = YogaNodeFactory.create(config); root.addChildAt(child1, 0); final YogaNode child2 = YogaNodeFactory.create(config); child2.setBaselineFunction(new YogaBaselineFunction() { public float baseline(YogaNode node, float width, float height) { return Float.NaN; } }); root.addChildAt(child2, 1); assertEquals(logs.size(), 0); try { root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); fail("Expected calculateLayout to throw"); } catch (IllegalStateException e) { } assertEquals(logs.size(), 1); config.setLogger(null); try { root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); fail("Expected calculateLayout to throw again"); } catch (IllegalStateException e) { } assertEquals(logs.size(), 1); } @Test public void testLoggerLeak() throws Exception { final YogaConfig config = YogaConfigFactory.create(); YogaLogger logger = new YogaLogger() { @Override public void log(YogaLogLevel level, String message) { } }; config.setLogger(logger); config.setLogger(null); WeakReference ref = new WeakReference(logger); // noinspection UnusedAssignment logger = null; // try and free for the next 5 seconds, usually it works after the // first GC attempt. for (int i=0; i < 50; i++) { System.gc(); if (ref.get() == null) { // free successfully return; } Thread.sleep(100); } fail("YogaLogger leaked"); } } ================================================ FILE: java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.java ================================================ /* * 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 static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class YogaNodeStylePropertiesTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; private static final float UNDEFINED = YogaValue.UNDEFINED.value; @Test public void testDirectionDefault() { final YogaNode node = createNode(); assertEquals(node.getStyleDirection(), YogaDirection.INHERIT); assertEquals(node.getLayoutDirection(), YogaDirection.INHERIT); } @Test public void testDirectionAssignment() { final YogaNode node = createNode(); node.setDirection(YogaDirection.LTR); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(YogaDirection.LTR, node.getStyleDirection()); assertEquals(YogaDirection.LTR, node.getLayoutDirection()); } @Test public void testDirectionAffectsLayout() { final YogaNode node = style().direction(YogaDirection.RTL).width(200).children(style().widthPercent(40)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(120, node.getChildAt(0).getLayoutX(), 0); } @Test public void testFlexDirectionDefault() { final YogaNode node = createNode(); assertEquals(YogaFlexDirection.COLUMN, node.getFlexDirection()); } @Test public void testFlexDirectionAssignment() { final YogaNode node = style().flexDirection(YogaFlexDirection.COLUMN_REVERSE).node(); assertEquals(YogaFlexDirection.COLUMN_REVERSE, node.getFlexDirection()); } @Test public void testFlexDirectionAffectsLayout() { final YogaNode node = style() .flexDirection(YogaFlexDirection.ROW_REVERSE) .width(200) .children(style().widthPercent(40)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(120, node.getChildAt(0).getLayoutX(), 0); } @Test public void testJustifyContentDefault() { final YogaNode node = createNode(); assertEquals(YogaJustify.FLEX_START, node.getJustifyContent()); } @Test public void testJustifyContentAssignment() { final YogaNode node = createNode(); node.setJustifyContent(YogaJustify.SPACE_EVENLY); assertEquals(YogaJustify.SPACE_EVENLY, node.getJustifyContent()); } @Test public void testJustifyContentAffectsLayout() { final YogaNode node = style() .justifyContent(YogaJustify.CENTER) .height(200) .children(style().heightPercent(40)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(60, node.getChildAt(0).getLayoutY(), 0); } @Test public void testAlignItemsDefault() { final YogaNode node = createNode(); assertEquals(YogaAlign.STRETCH, node.getAlignItems()); } @Test public void testAlignItemsAssignment() { final YogaNode node = createNode(); node.setAlignItems(YogaAlign.SPACE_AROUND); assertEquals(YogaAlign.SPACE_AROUND, node.getAlignItems()); } @Test public void testAlignItemsAffectsLayout() { final YogaNode node = style().alignItems(YogaAlign.CENTER).height(200).children(style().widthPercent(40)).node(); node.calculateLayout(200, UNDEFINED); assertEquals(60, node.getChildAt(0).getLayoutX(), 0); } @Test public void testAlignSelfDefault() { final YogaNode node = createNode(); assertEquals(YogaAlign.AUTO, node.getAlignSelf()); } @Test public void testAlignSelfAssignment() { final YogaNode node = createNode(); node.setAlignSelf(YogaAlign.FLEX_END); assertEquals(YogaAlign.FLEX_END, node.getAlignSelf()); } @Test public void testAlignSelfAffectsLayout() { final YogaNode node = style().height(200).children(style().alignSelf(YogaAlign.CENTER).widthPercent(40)).node(); node.calculateLayout(200, UNDEFINED); assertEquals(60, node.getChildAt(0).getLayoutX(), 0); } @Test public void testAlignContentDefault() { final YogaNode node = createNode(); assertEquals(YogaAlign.FLEX_START, node.getAlignContent()); } @Test public void testAlignContentAssignment() { final YogaNode node = createNode(); node.setAlignContent(YogaAlign.BASELINE); assertEquals(YogaAlign.BASELINE, node.getAlignContent()); } @Test public void testAlignContentAffectsLayout() { final YogaNode node = style() .alignContent(YogaAlign.SPACE_AROUND) .flexWrap(YogaWrap.WRAP) .height(200) .width(200) .children( style().widthPercent(20).heightPercent(60), style().widthPercent(20).heightPercent(60)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(30, node.getChildAt(0).getLayoutX(), 0); } @Test public void testPositionTypeDefault() { final YogaNode node = createNode(); assertEquals(YogaPositionType.RELATIVE, node.getPositionType()); } @Test public void testPositionTypeAssignment() { final YogaNode node = createNode(); node.setPositionType(YogaPositionType.ABSOLUTE); assertEquals(YogaPositionType.ABSOLUTE, node.getPositionType()); } @Test public void testPositionTypeAffectsLayout() { final YogaNode node = style() .height(200) .children( style().height(100), style().height(100).positionType(YogaPositionType.ABSOLUTE)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(0, node.getChildAt(1).getLayoutY(), 0); } @Test public void testWrapAffectsLayout() { final YogaNode node = style() .width(200) .height(200) .flexWrap(YogaWrap.WRAP_REVERSE) .children(style().width(10).heightPercent(60), style().heightPercent(60)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(190, node.getChildAt(0).getLayoutX(), 0); } @Test public void testOverflowDefault() { final YogaNode node = createNode(); assertEquals(YogaOverflow.VISIBLE, node.getOverflow()); } @Test public void testOverflowAssignment() { final YogaNode node = createNode(); node.setOverflow(YogaOverflow.SCROLL); assertEquals(YogaOverflow.SCROLL, node.getOverflow()); } // TODO add testOverflowAffectsLayout() @Test public void testDisplayDefault() { final YogaNode node = createNode(); assertEquals(YogaDisplay.FLEX, node.getDisplay()); } @Test public void testDisplayAssignment() { final YogaNode node = createNode(); node.setDisplay(YogaDisplay.NONE); assertEquals(YogaDisplay.NONE, node.getDisplay()); } @Test public void testDisplayAffectsLayout() { final YogaNode node = style().children(style().flexGrow(1).display(YogaDisplay.NONE), style().flexGrow(1)).node(); node.calculateLayout(200, 200); assertEquals(200, node.getChildAt(1).getLayoutHeight(), 0); } @Test public void testFlexAffectsLayoutGrowing() { final YogaNode node = style().height(200).children(style().height(100).flex(1.25f)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(200, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testFlexAffectsLayoutShrinking() { final YogaNode node = style().height(200).children(style().height(300).flex(1.25f)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(200, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testFlexGrowDefault() { final YogaNode node = createNode(); assertEquals(0, node.getFlexGrow(), 0); } @Test public void testFlexGrowAssignment() { final YogaNode node = createNode(); node.setFlexGrow(2.5f); assertEquals(2.5f, node.getFlexGrow(), 0); } @Test public void testFlexGrowAffectsLayout() { final YogaNode node = style().height(200).children(style().height(50).flexGrow(1), style().height(50)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(150, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testFlexShrinkDefault() { final YogaNode node = createNode(); assertEquals(0, node.getFlexShrink(), 0); } @Test public void testFlexShrinkAssignment() { final YogaNode node = createNode(); node.setFlexShrink(2.5f); assertEquals(2.5f, node.getFlexShrink(), 0); } @Test public void testFlexShrinkAffectsLayout() { final YogaNode node = style().height(200).children(style().height(150).flexShrink(1), style().height(150)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(50, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testFlexBasisDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.AUTO, node.getFlexBasis()); } @Test public void testFlexBasisAssignment() { final YogaNode node = createNode(); node.setFlexBasis(50); assertEquals(new YogaValue(50, YogaUnit.POINT), node.getFlexBasis()); node.setFlexBasisPercent(20); assertEquals(new YogaValue(20, YogaUnit.PERCENT), node.getFlexBasis()); node.setFlexBasisAuto(); assertEquals(YogaValue.AUTO, node.getFlexBasis()); } @Test public void testFlexBasisAffectsLayout() { final YogaNode node = style() .height(200) .children(style().flexBasis(150).flexShrink(1), style().flexBasis(150).flexShrink(1)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(100, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testFlexBasisPercentAffectsLayout() { final YogaNode node = style() .height(200) .children(style().flexBasisPercent(60), style().flexBasisPercent(40)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(80, node.getChildAt(1).getLayoutHeight(), 0); } @Test public void testMarginDefault() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { assertEquals(YogaValue.UNDEFINED, node.getMargin(edge)); } } @Test public void testMarginAssignment() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { node.setMargin(edge, 25); assertEquals(new YogaValue(25, YogaUnit.POINT), node.getMargin(edge)); node.setMarginPercent(edge, 5); assertEquals(new YogaValue(5, YogaUnit.PERCENT), node.getMargin(edge)); node.setMarginAuto(edge); assertEquals(YogaValue.AUTO, node.getMargin(edge)); } } @Test public void testNegativeMarginAssignment() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { node.setMargin(edge, -25); assertEquals(new YogaValue(-25, YogaUnit.POINT), node.getMargin(edge)); node.setMarginPercent(edge, -5); assertEquals(new YogaValue(-5, YogaUnit.PERCENT), node.getMargin(edge)); node.setMarginAuto(edge); assertEquals(YogaValue.AUTO, node.getMargin(edge)); } } @Test public void testMarginPointAffectsLayout() { final YogaNode node = style().margin(YogaEdge.TOP, 42).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(42, node.getLayoutY(), 0); } @Test public void testMarginPercentAffectsLayout() { final YogaNode node = style().height(200).children(style().flexGrow(1).marginPercent(YogaEdge.TOP, 20)).node(); node.calculateLayout(200, 200); assertEquals(40, node.getChildAt(0).getLayoutY(), 0); } @Test public void testMarginAutoAffectsLayout() { final YogaNode node = style() .width(200) .flexDirection(YogaFlexDirection.ROW) .children(style().marginAuto(YogaEdge.LEFT).marginAuto(YogaEdge.RIGHT).width(100)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(50, node.getChildAt(0).getLayoutX(), 0); } @Test public void testPaddingDefault() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { assertEquals(YogaValue.UNDEFINED, node.getPadding(edge)); } } @Test public void testPaddingAssignment() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { node.setPadding(edge, 25); assertEquals(new YogaValue(25, YogaUnit.POINT), node.getPadding(edge)); node.setPaddingPercent(edge, 5); assertEquals(new YogaValue(5, YogaUnit.PERCENT), node.getPadding(edge)); } } @Test public void testPaddingPointAffectsLayout() { final YogaNode node = style().padding(YogaEdge.TOP, 42).children(style()).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(42, node.getChildAt(0).getLayoutY(), 0); } @Test public void testPaddingPercentAffectsLayout() { final YogaNode node = style().height(200).paddingPercent(YogaEdge.TOP, 20).children(style().flexGrow(1)).node(); node.calculateLayout(200, 200); assertEquals(40, node.getChildAt(0).getLayoutY(), 0); } @Test public void testBorderDefault() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { assertEquals(UNDEFINED, node.getBorder(edge), 0); } } @Test public void testBorderAssignment() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { node.setBorder(edge, 2.5f); assertEquals(2.5f, node.getBorder(edge), 0); } } @Test public void testBorderAffectsLayout() { final YogaNode node = style().border(YogaEdge.TOP, 42).children(style()).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(42, node.getChildAt(0).getLayoutY(), 0); } @Test public void testPositionDefault() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { assertEquals(YogaValue.UNDEFINED, node.getPosition(edge)); } } @Test public void testPositionAssignment() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { node.setPosition(edge, 25); assertEquals(new YogaValue(25, YogaUnit.POINT), node.getPosition(edge)); node.setPositionPercent(edge, 5); assertEquals(new YogaValue(5, YogaUnit.PERCENT), node.getPosition(edge)); } } @Test public void testPositionAffectsLayout() { final YogaNode node = style() .height(100) .children( style() .positionType(YogaPositionType.ABSOLUTE) .position(YogaEdge.TOP, 11) .position(YogaEdge.BOTTOM, 22)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(67, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testPositionPercentAffectsLayout() { final YogaNode node = style() .width(100) .children( style() .positionType(YogaPositionType.ABSOLUTE) .positionPercent(YogaEdge.LEFT, 11) .positionPercent(YogaEdge.RIGHT, 22)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(67, node.getChildAt(0).getLayoutWidth(), 0); } @Test public void testWidthDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.AUTO, node.getWidth()); } @Test public void testWidthAssignment() { final YogaNode node = createNode(); node.setWidth(123); assertEquals(new YogaValue(123, YogaUnit.POINT), node.getWidth()); node.setWidthPercent(45); assertEquals(new YogaValue(45, YogaUnit.PERCENT), node.getWidth()); } @Test public void testWidthAffectsLayout() { final YogaNode node = style().width(123).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(123, node.getLayoutWidth(), 0); } @Test public void testWidthPercentAffectsLayout() { final YogaNode node = style().widthPercent(75).node(); node.calculateLayout(200, UNDEFINED); assertEquals(150, node.getLayoutWidth(), 0); } // TODO: testWidthAutoAffectsLayout @Test public void testHeightDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.AUTO, node.getHeight()); } @Test public void testHeightAssignment() { final YogaNode node = createNode(); node.setHeight(123); assertEquals(new YogaValue(123, YogaUnit.POINT), node.getHeight()); node.setHeightPercent(45); assertEquals(new YogaValue(45, YogaUnit.PERCENT), node.getHeight()); } @Test public void testHeightAffectsLayout() { final YogaNode node = style().height(123).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(123, node.getLayoutHeight(), 0); } @Test public void testHeightPercentAffectsLayout() { final YogaNode node = style().heightPercent(75).node(); node.calculateLayout(UNDEFINED, 200); assertEquals(150, node.getLayoutHeight(), 0); } // TODO: testHeightAutoAffectsLayout @Test public void testMinWidthDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.UNDEFINED, node.getMinWidth()); } @Test public void testMinWidthAssignment() { final YogaNode node = createNode(); node.setMinWidth(123); assertEquals(new YogaValue(123, YogaUnit.POINT), node.getMinWidth()); node.setMinWidthPercent(45); assertEquals(new YogaValue(45, YogaUnit.PERCENT), node.getMinWidth()); } @Test public void testMinWidthAffectsLayout() { final YogaNode node = style().minWidth(123).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(123, node.getLayoutWidth(), 0); } @Test public void testMinWidthPercentAffectsLayout() { final YogaNode node = style().minWidthPercent(120).node(); node.calculateLayout(200, UNDEFINED); assertEquals(240, node.getLayoutWidth(), 0); } @Test public void testMinHeightDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.UNDEFINED, node.getMinHeight()); } @Test public void testMinHeightAssignment() { final YogaNode node = createNode(); node.setMinHeight(123); assertEquals(new YogaValue(123, YogaUnit.POINT), node.getMinHeight()); node.setMinHeightPercent(45); assertEquals(new YogaValue(45, YogaUnit.PERCENT), node.getMinHeight()); } @Test public void testMinHeightAffectsLayout() { final YogaNode node = style().minHeight(123).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(123, node.getLayoutHeight(), 0); } @Test public void testMinHeightPercentAffectsLayout() { final YogaNode node = style().minHeightPercent(120).node(); node.calculateLayout(UNDEFINED, 200); assertEquals(240, node.getLayoutHeight(), 0); } @Test public void testMaxWidthDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.UNDEFINED, node.getMaxWidth()); } @Test public void testMaxWidthAssignment() { final YogaNode node = createNode(); node.setMaxWidth(123); assertEquals(new YogaValue(123, YogaUnit.POINT), node.getMaxWidth()); node.setMaxWidthPercent(45); assertEquals(new YogaValue(45, YogaUnit.PERCENT), node.getMaxWidth()); } @Test public void testMaxWidthAffectsLayout() { final YogaNode node = style().width(200).children(style().maxWidth(123)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(123, node.getChildAt(0).getLayoutWidth(), 0); } @Test public void testMaxWidthPercentAffectsLayout() { final YogaNode node = style().width(200).children(style().maxWidthPercent(80)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(160, node.getChildAt(0).getLayoutWidth(), 0); } @Test public void testMaxHeightDefault() { final YogaNode node = createNode(); assertEquals(YogaValue.UNDEFINED, node.getMaxHeight()); } @Test public void testMaxHeightAssignment() { final YogaNode node = createNode(); node.setMaxHeight(123); assertEquals(new YogaValue(123, YogaUnit.POINT), node.getMaxHeight()); node.setMaxHeightPercent(45); assertEquals(new YogaValue(45, YogaUnit.PERCENT), node.getMaxHeight()); } @Test public void testMaxHeightAffectsLayout() { final YogaNode node = style() .height(200) .flexDirection(YogaFlexDirection.ROW) .children(style().maxHeight(123)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(123, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testMaxHeightPercentAffectsLayout() { final YogaNode node = style() .flexDirection(YogaFlexDirection.ROW) .height(200) .children(style().maxHeightPercent(80)) .node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(160, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void testAspectRatioDefault() { final YogaNode node = createNode(); assertEquals(UNDEFINED, node.getAspectRatio(), 0); } @Test public void testAspectRatioAssignment() { final YogaNode node = createNode(); node.setAspectRatio(2.75f); assertEquals(2.75f, node.getAspectRatio(), 0); } @Test public void aspectRatioAffectsLayoutWithGivenWidth() { final YogaNode node = style().children(style().width(300).aspectRatio(1.5f)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(200, node.getChildAt(0).getLayoutHeight(), 0); } @Test public void aspectRatioAffectsLayoutWithGivenHeight() { final YogaNode node = style().children(style().height(300).aspectRatio(1.5f)).node(); node.calculateLayout(UNDEFINED, UNDEFINED); assertEquals(450, node.getChildAt(0).getLayoutWidth(), 0); } private YogaNode createNode() { return mNodeFactory.create(); } private StyledNode style() { return new StyledNode(mNodeFactory); } private static class StyledNode { private YogaNode mNode; public StyledNode(TestParametrization.NodeFactory nodeFactory) { mNode = nodeFactory.create(); } YogaNode node() { return mNode; } StyledNode children(StyledNode... children) { for (int i = mNode.getChildCount(); --i >= 0; ) { mNode.removeChildAt(i); } for (int i = 0; i < children.length; i++) { mNode.addChildAt(children[i].node(), i); } return this; } StyledNode direction(YogaDirection direction) { mNode.setDirection(direction); return this; } StyledNode width(float width) { mNode.setWidth(width); return this; } StyledNode widthPercent(float width) { mNode.setWidthPercent(width); return this; } StyledNode flexDirection(YogaFlexDirection direction) { mNode.setFlexDirection(direction); return this; } StyledNode justifyContent(YogaJustify justify) { mNode.setJustifyContent(justify); return this; } StyledNode height(float height) { mNode.setHeight(height); return this; } StyledNode heightPercent(float height) { mNode.setHeightPercent(height); return this; } StyledNode alignItems(YogaAlign align) { mNode.setAlignItems(align); return this; } StyledNode alignSelf(YogaAlign align) { mNode.setAlignSelf(align); return this; } StyledNode alignContent(YogaAlign align) { mNode.setAlignContent(align); return this; } StyledNode flexWrap(YogaWrap wrap) { mNode.setWrap(wrap); return this; } StyledNode positionType(YogaPositionType positionType) { mNode.setPositionType(positionType); return this; } StyledNode overflow(YogaOverflow overflow) { mNode.setOverflow(overflow); return this; } StyledNode flexShrink(float flexShrink) { mNode.setFlexShrink(flexShrink); return this; } StyledNode display(YogaDisplay display) { mNode.setDisplay(display); return this; } StyledNode flexGrow(float flexGrow) { mNode.setFlexGrow(flexGrow); return this; } StyledNode flex(float flex) { mNode.setFlex(flex); return this; } StyledNode flexBasis(float flexBasis) { mNode.setFlexBasis(flexBasis); return this; } StyledNode flexBasisPercent(float flexBasis) { mNode.setFlexBasisPercent(flexBasis); return this; } StyledNode margin(YogaEdge edge, float margin) { mNode.setMargin(edge, margin); return this; } StyledNode marginPercent(YogaEdge edge, float margin) { mNode.setMarginPercent(edge, margin); return this; } StyledNode marginAuto(YogaEdge edge) { mNode.setMarginAuto(edge); return this; } StyledNode padding(YogaEdge edge, float padding) { mNode.setPadding(edge, padding); return this; } StyledNode paddingPercent(YogaEdge edge, float padding) { mNode.setPaddingPercent(edge, padding); return this; } StyledNode border(YogaEdge edge, float border) { mNode.setBorder(edge, border); return this; } StyledNode position(YogaEdge edge, float position) { mNode.setPosition(edge, position); return this; } StyledNode positionPercent(YogaEdge edge, float position) { mNode.setPositionPercent(edge, position); return this; } StyledNode minWidth(float minWidth) { mNode.setMinWidth(minWidth); return this; } StyledNode minWidthPercent(float minWidth) { mNode.setMinWidthPercent(minWidth); return this; } StyledNode minHeight(float minHeight) { mNode.setMinHeight(minHeight); return this; } StyledNode minHeightPercent(float minHeight) { mNode.setMinHeightPercent(minHeight); return this; } StyledNode maxWidth(float maxWidth) { mNode.setMaxWidth(maxWidth); return this; } StyledNode maxWidthPercent(float maxWidth) { mNode.setMaxWidthPercent(maxWidth); return this; } StyledNode maxHeight(float maxHeight) { mNode.setMaxHeight(maxHeight); return this; } StyledNode maxHeightPercent(float maxHeight) { mNode.setMaxHeightPercent(maxHeight); return this; } StyledNode aspectRatio(float aspectRatio) { mNode.setAspectRatio(aspectRatio); return this; } } } ================================================ FILE: java/tests/com/facebook/yoga/YogaNodeTest.java ================================================ /* * 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 static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class YogaNodeTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void testInit() { final YogaNode node = createNode(); } @Test public void testBaseline() { final YogaNode root = createNode(); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); root.setWidth(100); root.setHeight(100); final YogaNode child1 = createNode(); child1.setWidth(40); child1.setHeight(40); root.addChildAt(child1, 0); final YogaNode child2 = createNode(); child2.setWidth(40); child2.setHeight(40); child2.setBaselineFunction(new YogaBaselineFunction() { public float baseline(YogaNode node, float width, float height) { return 0; } }); root.addChildAt(child2, 1); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0, (int) child1.getLayoutY()); assertEquals(40, (int) child2.getLayoutY()); } @Test public void testMeasure() { final YogaNode node = createNode(); node.setMeasureFunction(new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { return YogaMeasureOutput.make(100, 100); } }); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100, (int) node.getLayoutWidth()); assertEquals(100, (int) node.getLayoutHeight()); } @Test public void testMeasureFloat() { final YogaNode node = createNode(); node.setMeasureFunction(new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { return YogaMeasureOutput.make(100.5f, 100.5f); } }); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(101f, node.getLayoutWidth(), 0.01f); assertEquals(101f, node.getLayoutHeight(), 0.01f); } @Test public void testMeasureFloatMin() { final YogaNode node = createNode(); node.setMeasureFunction(new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { return YogaMeasureOutput.make(Float.MIN_VALUE, Float.MIN_VALUE); } }); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(Float.MIN_VALUE, node.getLayoutWidth(), 0.01f); assertEquals(Float.MIN_VALUE, node.getLayoutHeight(), 0.01f); } @Test public void testMeasureFloatBigNumber() { final YogaNode node = createNode(); final float bigNumber = (float) 10E5; node.setMeasureFunction( new YogaMeasureFunction() { public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { return YogaMeasureOutput.make(bigNumber, bigNumber); } }); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(bigNumber, node.getLayoutWidth(), 0.01f); assertEquals(bigNumber, node.getLayoutHeight(), 0.01f); } @Test public void testCopyStyle() { final YogaNode node0 = createNode(); assertTrue(YogaConstants.isUndefined(node0.getMaxHeight())); final YogaNode node1 = createNode(); node1.setMaxHeight(100); node0.copyStyle(node1); assertEquals(100, (int) node0.getMaxHeight().value); } @Test public void testLayoutMargin() { final YogaNode node = createNode(); node.setWidth(100); node.setHeight(100); node.setMargin(YogaEdge.START, 1); node.setMargin(YogaEdge.END, 2); node.setMargin(YogaEdge.TOP, 3); node.setMargin(YogaEdge.BOTTOM, 4); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(1, (int) node.getLayoutMargin(YogaEdge.LEFT)); assertEquals(2, (int) node.getLayoutMargin(YogaEdge.RIGHT)); assertEquals(3, (int) node.getLayoutMargin(YogaEdge.TOP)); assertEquals(4, (int) node.getLayoutMargin(YogaEdge.BOTTOM)); } @Test public void testLayoutPadding() { final YogaNode node = createNode(); node.setWidth(100); node.setHeight(100); node.setPadding(YogaEdge.START, 1); node.setPadding(YogaEdge.END, 2); node.setPadding(YogaEdge.TOP, 3); node.setPadding(YogaEdge.BOTTOM, 4); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(1, (int) node.getLayoutPadding(YogaEdge.LEFT)); assertEquals(2, (int) node.getLayoutPadding(YogaEdge.RIGHT)); assertEquals(3, (int) node.getLayoutPadding(YogaEdge.TOP)); assertEquals(4, (int) node.getLayoutPadding(YogaEdge.BOTTOM)); } @Test public void testLayoutBorder() { final YogaNode node = createNode(); node.setWidth(100); node.setHeight(100); node.setBorder(YogaEdge.START, 1); node.setBorder(YogaEdge.END, 2); node.setBorder(YogaEdge.TOP, 3); node.setBorder(YogaEdge.BOTTOM, 4); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(1, (int) node.getLayoutBorder(YogaEdge.LEFT)); assertEquals(2, (int) node.getLayoutBorder(YogaEdge.RIGHT)); assertEquals(3, (int) node.getLayoutBorder(YogaEdge.TOP)); assertEquals(4, (int) node.getLayoutBorder(YogaEdge.BOTTOM)); } @Test public void testUseWebDefaults() { final YogaConfig config = YogaConfigFactory.create(); config.setUseWebDefaults(true); final YogaNode node = createNode(config); assertEquals(YogaFlexDirection.ROW, node.getFlexDirection()); } @Test public void testPercentPaddingOnRoot() { final YogaNode node = createNode(); node.setPaddingPercent(YogaEdge.ALL, 10); node.calculateLayout(50, 50); assertEquals(5, (int) node.getLayoutPadding(YogaEdge.LEFT)); assertEquals(5, (int) node.getLayoutPadding(YogaEdge.RIGHT)); assertEquals(5, (int) node.getLayoutPadding(YogaEdge.TOP)); assertEquals(5, (int) node.getLayoutPadding(YogaEdge.BOTTOM)); } @Test public void testDefaultEdgeValues() { final YogaNode node = createNode(); for (YogaEdge edge : YogaEdge.values()) { assertEquals(YogaUnit.UNDEFINED, node.getMargin(edge).unit); assertEquals(YogaUnit.UNDEFINED, node.getPadding(edge).unit); assertEquals(YogaUnit.UNDEFINED, node.getPosition(edge).unit); assertTrue(YogaConstants.isUndefined(node.getBorder(edge))); } } @Test public void initiallyHasNewLayout() { YogaNode root = createNode(); assertTrue(root.hasNewLayout()); } @Test public void initialLayoutCanBeMarkedSeen() { YogaNode root = createNode(); root.markLayoutSeen(); assertFalse(root.hasNewLayout()); } @Test public void calculatingLayoutMarksLayoutAsUnseen() { YogaNode root = createNode(); root.markLayoutSeen(); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertTrue(root.hasNewLayout()); } @Test public void calculatedLayoutCanBeMarkedSeen() { YogaNode root = createNode(); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); root.markLayoutSeen(); assertFalse(root.hasNewLayout()); } @Test public void recalculatingLayoutDoesMarkAsUnseen() { YogaNode root = createNode(); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); root.markLayoutSeen(); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertTrue(root.hasNewLayout()); } @Test public void resetAlsoResetsLayoutSeen() { YogaNode root = createNode(); root.markLayoutSeen(); root.reset(); assertTrue(root.hasNewLayout()); } @Test public void directionIsPassedThrough() { YogaNode root = createNode(); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(root.getLayoutDirection(), YogaDirection.RTL); } @Test public void testResetApiShouldResetAllLayoutOutputs() { YogaConfig config = YogaConfigFactory.create(); config.setErrata(YogaErrata.STRETCH_FLEX_BASIS); YogaNode node = createNode(config); node.setWidth(100); node.setHeight(100); node.setMargin(YogaEdge.START, 1); node.setMargin(YogaEdge.END, 2); node.setMargin(YogaEdge.TOP, 3); node.setMargin(YogaEdge.BOTTOM, 4); node.setPadding(YogaEdge.START, 1); node.setPadding(YogaEdge.END, 2); node.setPadding(YogaEdge.TOP, 3); node.setPadding(YogaEdge.BOTTOM, 4); node.setBorder(YogaEdge.START, 1); node.setBorder(YogaEdge.END, 2); node.setBorder(YogaEdge.TOP, 3); node.setBorder(YogaEdge.BOTTOM, 4); node.setDirection(YogaDirection.RTL); node.markLayoutSeen(); node.setMeasureFunction(new YogaMeasureFunction(){ @Override public long measure(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { return YogaMeasureOutput.make(100, 100); } }); node.setBaselineFunction(new YogaBaselineFunction(){ @Override public float baseline(YogaNode node, float width, float height) { return height; } }); node.setData(new ArrayList<>()); node.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); node.reset(); assertEquals(0, (int) node.getLayoutHeight()); assertEquals(0, (int) node.getLayoutWidth()); assertEquals(0, (int) node.getLayoutMargin(YogaEdge.LEFT)); assertEquals(0, (int) node.getLayoutMargin(YogaEdge.RIGHT)); assertEquals(0, (int) node.getLayoutMargin(YogaEdge.TOP)); assertEquals(0, (int) node.getLayoutMargin(YogaEdge.BOTTOM)); assertEquals(0, (int) node.getLayoutPadding(YogaEdge.LEFT)); assertEquals(0, (int) node.getLayoutPadding(YogaEdge.RIGHT)); assertEquals(0, (int) node.getLayoutPadding(YogaEdge.TOP)); assertEquals(0, (int) node.getLayoutPadding(YogaEdge.BOTTOM)); assertEquals(0, (int) node.getLayoutBorder(YogaEdge.LEFT)); assertEquals(0, (int) node.getLayoutBorder(YogaEdge.RIGHT)); assertEquals(0, (int) node.getLayoutBorder(YogaEdge.TOP)); assertEquals(0, (int) node.getLayoutBorder(YogaEdge.BOTTOM)); assertEquals(node.getLayoutDirection(), YogaDirection.INHERIT); assertTrue(node.hasNewLayout()); assertFalse(node.isMeasureDefined()); assertFalse(node.isBaselineDefined()); assertEquals(null, node.getData()); } private YogaNode createNode() { return mNodeFactory.create(); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/com/facebook/yoga/YogaValueTest.java ================================================ /* * 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 org.junit.Test; import static org.junit.Assert.assertEquals; public class YogaValueTest { @Test public void testEquals() { assertEquals(new YogaValue(0, YogaUnit.UNDEFINED), new YogaValue(0, YogaUnit.UNDEFINED)); assertEquals(new YogaValue(0, YogaUnit.POINT), new YogaValue(0, YogaUnit.POINT)); assertEquals(new YogaValue(0, YogaUnit.PERCENT), new YogaValue(0, YogaUnit.PERCENT)); assertEquals(new YogaValue(0, YogaUnit.UNDEFINED), new YogaValue(1, YogaUnit.UNDEFINED)); assertEquals(new YogaValue(Float.NaN, YogaUnit.POINT), new YogaValue(Float.NaN, YogaUnit.POINT)); } } ================================================ FILE: java/tests/com/facebook/yoga/utils/TestUtils.java ================================================ /* * 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; } } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAbsolutePositionTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAbsolutePositionTest.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 YGAbsolutePositionTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_absolute_layout_width_height_start_top() { 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.setWidth(10f); root_child0.setHeight(10f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPosition(YogaEdge.START, 10f); root_child0.setPosition(YogaEdge.TOP, 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(10f, 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(10f, 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() { 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.setWidth(10f); root_child0.setHeight(10f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionAuto(YogaEdge.LEFT); root_child0.setPosition(YogaEdge.RIGHT, 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.setWidth(10f); root_child0.setHeight(10f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPosition(YogaEdge.LEFT, 10f); root_child0.setPositionAuto(YogaEdge.RIGHT); 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.setWidth(10f); root_child0.setHeight(10f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionAuto(YogaEdge.LEFT); root_child0.setPositionAuto(YogaEdge.RIGHT); 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(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setHeight(10f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPosition(YogaEdge.END, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 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(80f, 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(80f, 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_start_top_end_bottom() { 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.START, 10f); root_child0.setPosition(YogaEdge.TOP, 10f); root_child0.setPosition(YogaEdge.END, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_width_height_start_top_end_bottom() { 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.setWidth(10f); root_child0.setHeight(10f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPosition(YogaEdge.START, 10f); root_child0.setPosition(YogaEdge.TOP, 10f); root_child0.setPosition(YogaEdge.END, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 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(10f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(50f); root.setWidth(50f); root.setOverflow(YogaOverflow.HIDDEN); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPosition(YogaEdge.START, 0f); root_child0.setPosition(YogaEdge.TOP, 0f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(100f); root_child0_child0.setHeight(100f); root_child0.addChildAt(root_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(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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(50f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(-50f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_within_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setBorder(YogaEdge.ALL, 10f); root.setMargin(YogaEdge.ALL, 10f); root.setPadding(YogaEdge.ALL, 10); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setPosition(YogaEdge.LEFT, 0f); root_child0.setPosition(YogaEdge.TOP, 0f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setPositionType(YogaPositionType.ABSOLUTE); root_child1.setWidth(50f); root_child1.setHeight(50f); root_child1.setPosition(YogaEdge.RIGHT, 0f); root_child1.setPosition(YogaEdge.BOTTOM, 0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setPositionType(YogaPositionType.ABSOLUTE); root_child2.setWidth(50f); root_child2.setHeight(50f); root_child2.setPosition(YogaEdge.LEFT, 0f); root_child2.setPosition(YogaEdge.TOP, 0f); root_child2.setMargin(YogaEdge.ALL, 10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setPositionType(YogaPositionType.ABSOLUTE); root_child3.setWidth(50f); root_child3.setHeight(50f); root_child3.setPosition(YogaEdge.RIGHT, 0f); root_child3.setPosition(YogaEdge.BOTTOM, 0f); root_child3.setMargin(YogaEdge.ALL, 10f); root.addChildAt(root_child3, 3); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_and_justify_content_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_and_justify_content_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_justify_content_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_center_on_child_only() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); root_child0.setAlignSelf(YogaAlign.CENTER); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_and_justify_content_center_and_top_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); root_child0.setPosition(YogaEdge.TOP, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_and_justify_content_center_and_bottom_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); root_child0.setPosition(YogaEdge.BOTTOM, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(25f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_and_justify_content_center_and_left_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); root_child0.setPosition(YogaEdge.LEFT, 5f); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(5f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(5f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_align_items_and_justify_content_center_and_right_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(110f); root.setFlexGrow(1f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(60f); root_child0.setHeight(40f); root_child0.setPosition(YogaEdge.RIGHT, 5f); 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(45f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(45f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_position_root_with_rtl_should_position_withoutdirection() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setPosition(YogaEdge.LEFT, 72f); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(72f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(72f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_percentage_bottom_based_on_parent_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionPercent(YogaEdge.TOP, 50f); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setPositionType(YogaPositionType.ABSOLUTE); root_child1.setPositionPercent(YogaEdge.BOTTOM, 50f); root_child1.setWidth(10f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setPositionType(YogaPositionType.ABSOLUTE); root_child2.setPositionPercent(YogaEdge.TOP, 10f); root_child2.setWidth(10f); root_child2.setPositionPercent(YogaEdge.BOTTOM, 10f); 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(90f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(160f, 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(90f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(160f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_in_wrap_reverse_column_container() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_in_wrap_reverse_row_container() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); 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(80f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(80f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_in_wrap_reverse_column_container_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setAlignSelf(YogaAlign.FLEX_END); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_in_wrap_reverse_row_container_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setAlignSelf(YogaAlign.FLEX_END); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percent_absolute_position_infinite_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(300f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidthPercent(20f); root_child1.setHeightPercent(20f); root_child1.setPositionPercent(YogaEdge.LEFT, 20f); root_child1.setPositionPercent(YogaEdge.TOP, 20f); root_child1.setPositionType(YogaPositionType.ABSOLUTE); 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(300f, root.getLayoutWidth(), 0.0f); assertEquals(0f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(300f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(60f, 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(300f, root.getLayoutWidth(), 0.0f); assertEquals(0f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(300f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(60f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_percentage_height_based_on_padded_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.TOP, 10); root.setBorder(YogaEdge.TOP, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeightPercent(50f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); 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(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(45f, 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(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(45f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_percentage_height_based_on_padded_parent_and_align_items_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.TOP, 20); root.setPadding(YogaEdge.BOTTOM, 20); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(100f); root_child0.setHeightPercent(50f); 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(25f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(25f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_padding_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setPadding(YogaEdge.LEFT, 100); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, 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); } @Test public void test_absolute_layout_padding_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setPadding(YogaEdge.RIGHT, 100); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, 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(50f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_padding_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setPadding(YogaEdge.TOP, 100); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_padding_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setPadding(YogaEdge.BOTTOM, 100); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, 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); } @Test public void test_absolute_layout_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setMargin(YogaEdge.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setWidth(200f); root_child0_child0.setHeight(200f); root_child0_child0.setPadding(YogaEdge.ALL, 50); 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.setWidth(50f); root_child0_child0_child0.setHeight(50f); root_child0_child0.addChildAt(root_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(220f, root.getLayoutWidth(), 0.0f); assertEquals(220f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(220f, root.getLayoutWidth(), 0.0f); assertEquals(220f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setMargin(YogaEdge.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setWidth(200f); root_child0_child0.setHeight(200f); root_child0_child0.setBorder(YogaEdge.ALL, 10f); 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.setWidth(50f); root_child0_child0_child0.setHeight(50f); root_child0_child0.addChildAt(root_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(220f, root.getLayoutWidth(), 0.0f); assertEquals(220f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(220f, root.getLayoutWidth(), 0.0f); assertEquals(220f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(140f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_absolute_layout_column_reverse_margin_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setPosition(YogaEdge.LEFT, 5f); root_child0.setPosition(YogaEdge.RIGHT, 3f); root_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0.setMargin(YogaEdge.LEFT, 3f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.LEFT, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(8f, root_child0.getLayoutX(), 0.0f); assertEquals(150f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(143f, root_child0.getLayoutX(), 0.0f); assertEquals(150f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAlignContentTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAlignContentTest.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 YGAlignContentTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_align_content_flex_start_nowrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_start_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(10f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(20f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(10f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(20f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_start_wrap_singleline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_start_wrapped_negative_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_start_wrapped_negative_space_gap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root_child0.setGap(YogaGutter.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_start_without_height_on_children() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(10f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(20f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.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(0f, 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(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(10f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(20f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_start_with_flex() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(0f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setFlexGrow(1f); root_child1.setFlexBasisPercent(0f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setFlexGrow(1f); root_child3.setFlexShrink(1f); root_child3.setFlexBasisPercent(0f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(120f, 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(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(80f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(120f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.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(120f, 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(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(80f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(120f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_end_nowrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_end_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(90f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, 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(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(110f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(90f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(110f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_end_wrap_singleline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(110f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(110f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(110f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(110f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_end_wrapped_negative_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.FLEX_END); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(-10f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(-10f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_flex_end_wrapped_negative_space_gap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.FLEX_END); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root_child0.setGap(YogaGutter.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-70f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-40f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(-10f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-70f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-40f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(-10f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_center_nowrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_center_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(45f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(45f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(65f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(45f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(45f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(65f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_center_wrap_singleline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(55f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(55f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_center_wrapped_negative_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.CENTER); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_center_wrapped_negative_space_gap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.CENTER); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root_child0.setGap(YogaGutter.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_between_nowrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_BETWEEN); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_between_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_BETWEEN); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(110f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(110f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_between_wrap_singleline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_BETWEEN); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_between_wrapped_negative_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_BETWEEN); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_between_wrapped_negative_space_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_BETWEEN); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_between_wrapped_negative_space_gap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_BETWEEN); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root_child0.setGap(YogaGutter.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_nowrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(15f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(95f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(15f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(95f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_wrap_singleline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(55f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(55f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_wrapped_negative_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_AROUND); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_wrapped_negative_space_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_AROUND); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_wrapped_negative_space_gap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_AROUND); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root_child0.setGap(YogaGutter.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_nowrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, 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(10f, 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(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(23f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(23f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(88f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(23f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(23f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(55f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(55f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(88f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_wrap_singleline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(140f); root.setHeight(120f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(55f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, 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(140f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(55f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_wrapped_negative_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_EVENLY); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_wrapped_negative_space_gap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setHeight(320f); root.setBorder(YogaEdge.ALL, 60f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setAlignContent(YogaAlign.SPACE_EVENLY); root_child0.setJustifyContent(YogaJustify.CENTER); root_child0.setHeight(10f); root_child0.setGap(YogaGutter.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(80f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(80f); root_child0_child1.setHeight(20f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidthPercent(80f); root_child0_child2.setHeight(20f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(60f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(0f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.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(100f, 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(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(0f, root_child3.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(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); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(100f, 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); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_children() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); 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.addChildAt(root_child0_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(50f, 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(50f, root_child0_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); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(100f, 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(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_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); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_flex() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(1f); root_child1.setFlexBasisPercent(0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setFlexGrow(1f); root_child3.setFlexShrink(1f); root_child3.setFlexBasisPercent(0f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.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); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(0f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.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); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(0f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_flex_no_shrink() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(1f); root_child1.setFlexBasisPercent(0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setFlexGrow(1f); root_child3.setFlexBasisPercent(0f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.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); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(0f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.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); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(0f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setMargin(YogaEdge.ALL, 10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setMargin(YogaEdge.ALL, 10f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(40f, root_child2.getLayoutHeight(), 0.0f); assertEquals(60f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.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(100f, 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(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(40f, root_child2.getLayoutHeight(), 0.0f); assertEquals(40f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(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); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(100f, 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); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_single_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); 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(150f, 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(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, 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(150f, root.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, 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(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_fixed_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(60f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(80f, 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(60f, 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(80f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.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(100f, 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(80f, 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(60f, 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(80f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setMaxHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(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(20f, 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); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(100f, 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(20f, 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); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_row_with_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setMinHeight(80f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); 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(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(90f, 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(90f, 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(90f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(90f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.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(100f, 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(90f, 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(90f, 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(90f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(90f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(150f); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); 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.addChildAt(root_child0_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(50f); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(1f); root_child1.setFlexBasisPercent(0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(50f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root.addChildAt(root_child4, 4); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_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(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(150f, 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(50f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_is_not_overriding_align_items() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setAlignItems(YogaAlign.CENTER); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setAlignContent(YogaAlign.STRETCH); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(10f); root_child0_child0.setWidth(10f); root_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0.addChildAt(root_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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(45f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(45f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_with_min_cross_axis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMinHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(250f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(250f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_with_max_cross_axis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMaxHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(400f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_with_max_cross_axis_and_border_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMaxHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); root.setBorder(YogaEdge.ALL, 5f); root.setPadding(YogaEdge.ALL, 2); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(414f, root.getLayoutHeight(), 0.0f); assertEquals(7f, root_child0.getLayoutX(), 0.0f); assertEquals(7f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(7f, root_child1.getLayoutX(), 0.0f); assertEquals(207f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(414f, root.getLayoutHeight(), 0.0f); assertEquals(93f, root_child0.getLayoutX(), 0.0f); assertEquals(7f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(93f, root_child1.getLayoutX(), 0.0f); assertEquals(207f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_with_min_cross_axis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMinHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(33f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(267f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(33f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(267f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_with_max_cross_axis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMaxHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(400f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_with_max_cross_axis_violated() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMaxHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, 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(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(300f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_with_max_cross_axis_violated_padding_and_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMaxHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_EVENLY); root.setBorder(YogaEdge.ALL, 5f); root.setPadding(YogaEdge.ALL, 2); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(300f, root.getLayoutHeight(), 0.0f); assertEquals(7f, root_child0.getLayoutX(), 0.0f); assertEquals(7f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(7f, root_child1.getLayoutX(), 0.0f); assertEquals(207f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(300f, root.getLayoutHeight(), 0.0f); assertEquals(93f, root_child0.getLayoutX(), 0.0f); assertEquals(7f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(93f, root_child1.getLayoutX(), 0.0f); assertEquals(207f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_around_and_align_items_flex_end_with_flex_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_AROUND); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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(88f, 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(88f, 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_space_around_and_align_items_center_with_flex_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_AROUND); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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(63f, 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(63f, 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_space_around_and_align_items_flex_start_with_flex_wrap() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_AROUND); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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(38f, 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(38f, 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_flex_start_stretch_doesnt_influence_line_box_dim() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(400f); root.setFlexDirection(YogaFlexDirection.ROW); root.setPadding(YogaEdge.TOP, 20); root.setPadding(YogaEdge.BOTTOM, 20); root.setPadding(YogaEdge.LEFT, 20); root.setPadding(YogaEdge.RIGHT, 20); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setMargin(YogaEdge.RIGHT, 20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexDirection(YogaFlexDirection.ROW); root_child1.setWrap(YogaWrap.WRAP); root_child1.setFlexShrink(1f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setHeight(30f); root_child1_child0.setWidth(30f); root_child1_child0.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setHeight(30f); root_child1_child1.setWidth(30f); root_child1_child1.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setHeight(30f); root_child1_child2.setWidth(30f); root_child1_child2.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child1_child3 = createNode(config); root_child1_child3.setHeight(30f); root_child1_child3.setWidth(30f); root_child1_child3.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child3, 3); final YogaNode root_child1_child4 = createNode(config); root_child1_child4.setHeight(30f); root_child1_child4.setWidth(30f); root_child1_child4.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child4, 4); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(50f); root_child2.setMargin(YogaEdge.LEFT, 20f); 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(140f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(170f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutX(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f); assertEquals(330f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(260f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(170f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(70f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f); assertEquals(70f, root_child1_child4.getLayoutX(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_stretch_stretch_does_influence_line_box_dim() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(400f); root.setFlexDirection(YogaFlexDirection.ROW); root.setPadding(YogaEdge.TOP, 20); root.setPadding(YogaEdge.BOTTOM, 20); root.setPadding(YogaEdge.LEFT, 20); root.setPadding(YogaEdge.RIGHT, 20); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setMargin(YogaEdge.RIGHT, 20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexDirection(YogaFlexDirection.ROW); root_child1.setWrap(YogaWrap.WRAP); root_child1.setFlexShrink(1f); root_child1.setFlexGrow(1f); root_child1.setAlignContent(YogaAlign.STRETCH); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setHeight(30f); root_child1_child0.setWidth(30f); root_child1_child0.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setHeight(30f); root_child1_child1.setWidth(30f); root_child1_child1.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setHeight(30f); root_child1_child2.setWidth(30f); root_child1_child2.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child1_child3 = createNode(config); root_child1_child3.setHeight(30f); root_child1_child3.setWidth(30f); root_child1_child3.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child3, 3); final YogaNode root_child1_child4 = createNode(config); root_child1_child4.setHeight(30f); root_child1_child4.setWidth(30f); root_child1_child4.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child4, 4); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(50f); root_child2.setMargin(YogaEdge.LEFT, 20f); 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(140f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(170f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f); assertEquals(330f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(260f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(170f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(70f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f); assertEquals(70f, root_child1_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_align_content_space_evenly_stretch_does_influence_line_box_dim() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(400f); root.setFlexDirection(YogaFlexDirection.ROW); root.setPadding(YogaEdge.TOP, 20); root.setPadding(YogaEdge.BOTTOM, 20); root.setPadding(YogaEdge.LEFT, 20); root.setPadding(YogaEdge.RIGHT, 20); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setMargin(YogaEdge.RIGHT, 20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexDirection(YogaFlexDirection.ROW); root_child1.setWrap(YogaWrap.WRAP); root_child1.setFlexShrink(1f); root_child1.setFlexGrow(1f); root_child1.setAlignContent(YogaAlign.STRETCH); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setHeight(30f); root_child1_child0.setWidth(30f); root_child1_child0.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setHeight(30f); root_child1_child1.setWidth(30f); root_child1_child1.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setHeight(30f); root_child1_child2.setWidth(30f); root_child1_child2.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child1_child3 = createNode(config); root_child1_child3.setHeight(30f); root_child1_child3.setWidth(30f); root_child1_child3.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child3, 3); final YogaNode root_child1_child4 = createNode(config); root_child1_child4.setHeight(30f); root_child1_child4.setWidth(30f); root_child1_child4.setMargin(YogaEdge.RIGHT, 20f); root_child1.addChildAt(root_child1_child4, 4); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(50f); root_child2.setMargin(YogaEdge.LEFT, 20f); 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(140f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(170f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f); assertEquals(330f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(260f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(170f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(70f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f); assertEquals(70f, root_child1_child4.getLayoutX(), 0.0f); assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root_child0.setAlignSelf(YogaAlign.FLEX_START); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root_child0.setAlignSelf(YogaAlign.FLEX_END); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root_child0.setAlignSelf(YogaAlign.FLEX_END); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidth(150f); root_child0.setAlignSelf(YogaAlign.FLEX_END); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); root_child1.setWidth(120f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(50f); root_child2.setWidth(120f); 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); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAlignItemsTest.java ================================================ /* * 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<<309d24a29d92477022ee155afc4ade82>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAlignItemsTest.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 YGAlignItemsTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_align_items_stretch() { 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.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(100f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_items_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(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(45f, 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(45f, 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_align_items_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(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_align_items_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(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(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); 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(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); 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(20f); 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, 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(50f, 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(30f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); 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(20f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_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(50f, 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(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_multiline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(25f); root_child1.setWrap(YogaWrap.WRAP); root_child1.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(25f); root_child1_child0.setHeight(20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setWidth(25f); root_child1_child1.setHeight(10f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setWidth(25f); root_child1_child2.setHeight(20f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child1_child3 = createNode(config); root_child1_child3.setWidth(25f); root_child1_child3.setHeight(10f); root_child1.addChildAt(root_child1_child3, 3); 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(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child3.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(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_multiline_override() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(25f); root_child1.setWrap(YogaWrap.WRAP); root_child1.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(25f); root_child1_child0.setHeight(20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setWidth(25f); root_child1_child1.setHeight(10f); root_child1_child1.setAlignSelf(YogaAlign.BASELINE); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setWidth(25f); root_child1_child2.setHeight(20f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child1_child3 = createNode(config); root_child1_child3.setWidth(25f); root_child1_child3.setHeight(10f); root_child1_child3.setAlignSelf(YogaAlign.BASELINE); root_child1.addChildAt(root_child1_child3, 3); 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(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child3.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(60f, 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(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_multiline_no_override_on_secondline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(25f); root_child1.setWrap(YogaWrap.WRAP); root_child1.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(25f); root_child1_child0.setHeight(20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setWidth(25f); root_child1_child1.setHeight(10f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setWidth(25f); root_child1_child2.setHeight(20f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child1_child3 = createNode(config); root_child1_child3.setWidth(25f); root_child1_child3.setHeight(10f); root_child1_child3.setAlignSelf(YogaAlign.BASELINE); root_child1.addChildAt(root_child1_child3, 3); 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(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child3.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(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setPosition(YogaEdge.TOP, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_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(10f, 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(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, 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(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_top2() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); 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(20f); root_child1.setPosition(YogaEdge.TOP, 5f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(45f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_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(50f, 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(45f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_double_nested_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(15f); root_child1.addChildAt(root_child1_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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(5f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(15f, root_child1_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(50f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(5f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.BASELINE); 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(20f); 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(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(20f, 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(50f, 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(50f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMargin(YogaEdge.ALL, 5f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1_child0.setMargin(YogaEdge.ALL, 1f); root_child1.addChildAt(root_child1_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(5f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(44f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(1f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(1f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_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(45f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child1.getLayoutX(), 0.0f); assertEquals(44f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-1f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(1f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_child_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); 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(20f); root_child1.setPadding(YogaEdge.ALL, 5); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_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(5f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(55f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(5f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_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(45f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-5f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-5f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_multiline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); root.setWrap(YogaWrap.WRAP); 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(20f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child2_child0 = createNode(config); root_child2_child0.setWidth(50f); root_child2_child0.setHeight(10f); root_child2.addChildAt(root_child2_child0, 0); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(50f); root.addChildAt(root_child3, 3); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.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(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(60f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(60f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(50f, root_child3.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_align_baseline_multiline_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.BASELINE); root.setWrap(YogaWrap.WRAP); 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(30f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(20f); root_child1_child0.setHeight(20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); root_child2.setHeight(70f); root.addChildAt(root_child2, 2); final YogaNode root_child2_child0 = createNode(config); root_child2_child0.setWidth(10f); root_child2_child0.setHeight(10f); root_child2.addChildAt(root_child2_child0, 0); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(70f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(70f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(70f, root_child2.getLayoutHeight(), 0.0f); assertEquals(30f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(70f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_align_baseline_multiline_column2() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.BASELINE); root.setWrap(YogaWrap.WRAP); 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(30f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(20f); root_child1_child0.setHeight(20f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); root_child2.setHeight(70f); root.addChildAt(root_child2, 2); final YogaNode root_child2_child0 = createNode(config); root_child2_child0.setWidth(10f); root_child2_child0.setHeight(10f); root_child2.addChildAt(root_child2_child0, 0); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(70f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(70f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(70f, root_child2.getLayoutHeight(), 0.0f); assertEquals(30f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(70f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_align_baseline_multiline_row_and_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.BASELINE); root.setWrap(YogaWrap.WRAP); 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_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child2_child0 = createNode(config); root_child2_child0.setWidth(50f); root_child2_child0.setHeight(10f); root_child2.addChildAt(root_child2_child0, 0); final YogaNode root_child3 = createNode(config); root_child3.setWidth(50f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.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(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child2_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child2_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(50f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_align_items_center_child_with_margin_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setAlignItems(YogaAlign.CENTER); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(52f); root_child0_child0.setHeight(52f); root_child0_child0.setMargin(YogaEdge.LEFT, 10f); root_child0_child0.setMargin(YogaEdge.RIGHT, 10f); root_child0.addChildAt(root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(52f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(52f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_items_flex_end_child_with_margin_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setAlignItems(YogaAlign.FLEX_END); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(52f); root_child0_child0.setHeight(52f); root_child0_child0.setMargin(YogaEdge.LEFT, 10f); root_child0_child0.setMargin(YogaEdge.RIGHT, 10f); root_child0.addChildAt(root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(52f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(52f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(52f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_items_center_child_without_margin_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setAlignItems(YogaAlign.CENTER); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(72f); root_child0_child0.setHeight(72f); root_child0.addChildAt(root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_items_flex_end_child_without_margin_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setAlignItems(YogaAlign.FLEX_END); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(72f); root_child0_child0.setHeight(72f); root_child0.addChildAt(root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_center_should_size_based_on_content() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.CENTER); root.setMargin(YogaEdge.TOP, 20f); final YogaNode root_child0 = createNode(config); root_child0.setFlexShrink(1f); root_child0.setJustifyContent(YogaJustify.CENTER); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setWidth(20f); root_child0_child0_child0.setHeight(20f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(20f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(40f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(20f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(40f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_stretch_should_size_based_on_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setMargin(YogaEdge.TOP, 20f); final YogaNode root_child0 = createNode(config); root_child0.setFlexShrink(1f); root_child0.setJustifyContent(YogaJustify.CENTER); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setWidth(20f); root_child0_child0_child0.setHeight(20f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(20f, 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(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(20f, 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(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_flex_start_with_shrinking_children() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root_child0.setAlignItems(YogaAlign.FLEX_START); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setFlexGrow(1f); root_child0_child0_child0.setFlexShrink(1f); root_child0_child0.addChildAt(root_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, 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(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_flex_start_with_stretching_children() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setFlexGrow(1f); root_child0_child0_child0.setFlexShrink(1f); root_child0_child0.addChildAt(root_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, 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(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(500f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, 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(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(500f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_flex_start_with_shrinking_children_with_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root_child0.setAlignItems(YogaAlign.FLEX_START); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setFlexGrow(1f); root_child0_child0_child0.setFlexShrink(1f); root_child0_child0.addChildAt(root_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, 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(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_flex_end_with_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(75f); root.setAlignItems(YogaAlign.FLEX_END); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMargin(YogaEdge.RIGHT, 5f); root_child0.setMargin(YogaEdge.LEFT, 3f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); 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(75f, root.getLayoutHeight(), 0.0f); assertEquals(3f, 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(58f, 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); 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(75f, root.getLayoutHeight(), 0.0f); assertEquals(45f, 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(-8f, 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); } @Test public void test_align_stretch_with_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(75f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMargin(YogaEdge.RIGHT, 5f); root_child0.setMargin(YogaEdge.LEFT, 3f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); 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(75f, root.getLayoutHeight(), 0.0f); assertEquals(3f, 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(58f, 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); 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(75f, root.getLayoutHeight(), 0.0f); assertEquals(45f, 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(-8f, 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); } @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.setWidth(0f); 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); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAlignSelfTest.java ================================================ /* * 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<<13d0f5f70b716118796f3e4aff80c608>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAlignSelfTest.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 YGAlignSelfTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_align_self_center() { 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.setHeight(10f); root_child0.setWidth(10f); root_child0.setAlignSelf(YogaAlign.CENTER); 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(45f, 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(45f, 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_align_self_flex_end() { 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.setHeight(10f); root_child0.setWidth(10f); root_child0.setAlignSelf(YogaAlign.FLEX_END); 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(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); 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(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_self_flex_start() { 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.setHeight(10f); root_child0.setWidth(10f); root_child0.setAlignSelf(YogaAlign.FLEX_START); 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_align_self_flex_end_override_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(10f); root_child0.setAlignSelf(YogaAlign.FLEX_END); 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(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); 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(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_self_baseline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setAlignSelf(YogaAlign.BASELINE); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(20f); root_child1.setAlignSelf(YogaAlign.BASELINE); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(50f); root_child1_child0.setHeight(10f); root_child1.addChildAt(root_child1_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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_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(50f, 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(40f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAndroidNewsFeed.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAndroidNewsFeed.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 YGAndroidNewsFeed { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_android_news_feed() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setAlignContent(YogaAlign.STRETCH); root.setWidth(1080f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0_child0_child0.setAlignItems(YogaAlign.FLEX_START); root_child0_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 24f); root_child0_child0_child0_child0.setMargin(YogaEdge.START, 36f); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0_child0_child0_child0.setWidth(120f); root_child0_child0_child0_child0_child0_child0.setHeight(120f); root_child0_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0_child1 = createNode(config); root_child0_child0_child0_child0_child1.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0_child0_child1.setFlexShrink(1f); root_child0_child0_child0_child0_child1.setMargin(YogaEdge.RIGHT, 36f); root_child0_child0_child0_child0_child1.setPadding(YogaEdge.LEFT, 36); root_child0_child0_child0_child0_child1.setPadding(YogaEdge.TOP, 21); root_child0_child0_child0_child0_child1.setPadding(YogaEdge.RIGHT, 36); root_child0_child0_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 18); root_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child1, 1); final YogaNode root_child0_child0_child0_child0_child1_child0 = createNode(config); root_child0_child0_child0_child0_child1_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0_child0_child0_child1_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0_child0_child1_child0.setFlexShrink(1f); root_child0_child0_child0_child0_child1.addChildAt(root_child0_child0_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child0_child0_child1_child1 = createNode(config); root_child0_child0_child0_child0_child1_child1.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0_child0_child1_child1.setFlexShrink(1f); root_child0_child0_child0_child0_child1.addChildAt(root_child0_child0_child0_child0_child1_child1, 1); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setAlignContent(YogaAlign.STRETCH); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0_child1_child0.setAlignItems(YogaAlign.FLEX_START); root_child0_child0_child1_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 24f); root_child0_child0_child1_child0.setMargin(YogaEdge.START, 174f); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child1_child0_child0 = createNode(config); root_child0_child0_child1_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0_child1_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child1_child0.addChildAt(root_child0_child0_child1_child0_child0, 0); final YogaNode root_child0_child0_child1_child0_child0_child0 = createNode(config); root_child0_child0_child1_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child1_child0_child0_child0.setWidth(72f); root_child0_child0_child1_child0_child0_child0.setHeight(72f); root_child0_child0_child1_child0_child0.addChildAt(root_child0_child0_child1_child0_child0_child0, 0); final YogaNode root_child0_child0_child1_child0_child1 = createNode(config); root_child0_child0_child1_child0_child1.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child1_child0_child1.setFlexShrink(1f); root_child0_child0_child1_child0_child1.setMargin(YogaEdge.RIGHT, 36f); root_child0_child0_child1_child0_child1.setPadding(YogaEdge.LEFT, 36); root_child0_child0_child1_child0_child1.setPadding(YogaEdge.TOP, 21); root_child0_child0_child1_child0_child1.setPadding(YogaEdge.RIGHT, 36); root_child0_child0_child1_child0_child1.setPadding(YogaEdge.BOTTOM, 18); root_child0_child0_child1_child0.addChildAt(root_child0_child0_child1_child0_child1, 1); final YogaNode root_child0_child0_child1_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0_child1_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0_child1_child0_child1_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child1_child0_child1_child0.setFlexShrink(1f); root_child0_child0_child1_child0_child1.addChildAt(root_child0_child0_child1_child0_child1_child0, 0); final YogaNode root_child0_child0_child1_child0_child1_child1 = createNode(config); root_child0_child0_child1_child0_child1_child1.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child1_child0_child1_child1.setFlexShrink(1f); root_child0_child0_child1_child0_child1.addChildAt(root_child0_child0_child1_child0_child1_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(1080f, root.getLayoutWidth(), 0.0f); assertEquals(240f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f); assertEquals(240f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(1080f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(240f, 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(1080f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(144f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(24f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(1044f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(39f, root_child0_child0_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child0_child0_child1_child1.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child0_child0_child1_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(144f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(1080f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(96f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(174f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(24f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(906f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child1.getLayoutWidth(), 0.0f); assertEquals(39f, root_child0_child0_child1_child0_child1.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child1_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child1_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child1_child0_child1_child1.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child1_child0_child1_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_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(1080f, root.getLayoutWidth(), 0.0f); assertEquals(240f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f); assertEquals(240f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(1080f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(240f, 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(1080f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(144f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(24f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(1044f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(924f, root_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(816f, root_child0_child0_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(39f, root_child0_child0_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child0_child0_child1_child1.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child0_child0_child1_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(144f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(1080f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(96f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(24f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(906f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(834f, root_child0_child0_child1_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(726f, root_child0_child0_child1_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1.getLayoutY(), 0.0f); assertEquals(72f, root_child0_child0_child1_child0_child1.getLayoutWidth(), 0.0f); assertEquals(39f, root_child0_child0_child1_child0_child1.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child1_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child1_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0_child0_child1_child0_child1_child1.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0_child1_child0_child1_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child1_child0_child1_child1.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAspectRatioTest.java ================================================ /* * 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<<8b4a31ae00448d1d53e9449c804b2a79>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAspectRatioTest.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 YGAspectRatioTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test @Ignore public void test_aspect_ratio_does_not_stretch_cross_axis_dim() { 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.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); root_child0.setOverflow(YogaOverflow.SCROLL); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setFlexGrow(2f); root_child0_child0_child0.setFlexShrink(1f); root_child0_child0_child0.setFlexBasisPercent(0f); root_child0_child0_child0.setAspectRatio(1f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidth(5f); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setFlexGrow(1f); root_child0_child0_child2.setFlexShrink(1f); root_child0_child0_child2.setFlexBasisPercent(0f); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setFlexGrow(1f); root_child0_child0_child2_child0.setFlexShrink(1f); root_child0_child0_child2_child0.setFlexBasisPercent(0f); root_child0_child0_child2_child0.setAspectRatio(1f); root_child0_child0_child2.addChildAt(root_child0_child0_child2_child0, 0); final YogaNode root_child0_child0_child2_child0_child0 = createNode(config); root_child0_child0_child2_child0_child0.setWidth(5f); root_child0_child0_child2_child0.addChildAt(root_child0_child0_child2_child0_child0, 0); final YogaNode root_child0_child0_child2_child0_child1 = createNode(config); root_child0_child0_child2_child0_child1.setFlexGrow(1f); root_child0_child0_child2_child0_child1.setFlexShrink(1f); root_child0_child0_child2_child0_child1.setFlexBasisPercent(0f); root_child0_child0_child2_child0_child1.setAspectRatio(1f); root_child0_child0_child2_child0.addChildAt(root_child0_child0_child2_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(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(300f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(300f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(197f, 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(197f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(197f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(202f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(98f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(98f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child2_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutY(), 0.0f); assertEquals(98f, root_child0_child0_child2_child0_child1.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child2_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(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(300f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(300f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(103f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(197f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(98f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(98f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(98f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(197f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); assertEquals(93f, root_child0_child0_child2_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutY(), 0.0f); assertEquals(5f, root_child0_child0_child2_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child2_child0_child1.getLayoutY(), 0.0f); assertEquals(98f, root_child0_child0_child2_child0_child1.getLayoutWidth(), 0.0f); 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.setAspectRatio(0f); root_child0.setWidth(50f); 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); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGAutoTest.java ================================================ /* * 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<<649daae1073830c91842097b7bac9cda>> * generated by gentest/src/GentestDriver.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 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidthAuto(); root.setHeight(50f); root.setFlexDirection(YogaFlexDirection.ROW); 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); root.setFlexBasisAuto(); 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.setWidth(25f); root_child0.setHeight(25f); root_child0.setPositionAuto(YogaEdge.RIGHT); 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.setWidth(25f); root_child0.setHeight(25f); root_child0.setMarginAuto(YogaEdge.LEFT); 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: java/tests/generated/com/facebook/yoga/YGBorderTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGBorderTest.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 YGBorderTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_border_no_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setBorder(YogaEdge.ALL, 10f); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.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(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); } @Test public void test_border_container_match_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setBorder(YogaEdge.ALL, 10f); final YogaNode root_child0 = createNode(config); 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(30f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, 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(30f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_border_flex_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.ALL, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setFlexGrow(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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_border_stretch_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.ALL, 10f); final YogaNode root_child0 = createNode(config); 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_border_center_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.START, 10f); root.setBorder(YogaEdge.END, 20f); root.setBorder(YogaEdge.BOTTOM, 20f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(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(40f, root_child0.getLayoutX(), 0.0f); assertEquals(35f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(35f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGBoxSizingTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGBoxSizingTest.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 YGBoxSizingTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_box_sizing_content_box_simple() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); root.setBorder(YogaEdge.ALL, 10f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(130f, root.getLayoutWidth(), 0.0f); assertEquals(130f, root.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(130f, root.getLayoutWidth(), 0.0f); assertEquals(130f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_simple() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); root.setBorder(YogaEdge.ALL, 10f); 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); 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); } @Test public void test_box_sizing_content_box_percent() { 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.setWidthPercent(50f); root_child0.setHeightPercent(25f); root_child0.setPadding(YogaEdge.ALL, 4); root_child0.setBorder(YogaEdge.ALL, 16f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(65f, 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(65f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_percent() { 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.setWidthPercent(50f); root_child0.setHeightPercent(25f); root_child0.setPadding(YogaEdge.ALL, 4); root_child0.setBorder(YogaEdge.ALL, 16f); 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_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.setHeightPercent(25f); root_child0.setPadding(YogaEdge.ALL, 12); root_child0.setBorder(YogaEdge.ALL, 8f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPositionType(YogaPositionType.ABSOLUTE); 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(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(65f, 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(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(65f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_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.setHeightPercent(25f); root_child0.setPadding(YogaEdge.ALL, 12); root_child0.setBorder(YogaEdge.ALL, 8f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); 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(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_comtaining_block() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 12); root.setBorder(YogaEdge.ALL, 8f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.STATIC); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeightPercent(25f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.addChildAt(root_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(140f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, 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(31f, root_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(140f, root.getLayoutWidth(), 0.0f); assertEquals(140f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, 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(31f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_comtaining_block() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 12); root.setBorder(YogaEdge.ALL, 8f); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.STATIC); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeightPercent(25f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.addChildAt(root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, 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(21f, root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_padding_only() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(110f, root.getLayoutWidth(), 0.0f); assertEquals(110f, root.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(110f, root.getLayoutWidth(), 0.0f); assertEquals(110f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_padding_only_percent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(150f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(75f); root_child0.setPaddingPercent(YogaEdge.ALL, 10); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); 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(150f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(70f, root_child0.getLayoutWidth(), 0.0f); assertEquals(95f, 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(150f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(70f, root_child0.getLayoutWidth(), 0.0f); assertEquals(95f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_padding_only() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); 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); 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); } @Test public void test_box_sizing_border_box_padding_only_percent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(150f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(75f); root_child0.setPaddingPercent(YogaEdge.ALL, 10); 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(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(75f, 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(150f, 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(75f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_border_only() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.ALL, 10f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(120f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.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(120f, root.getLayoutWidth(), 0.0f); assertEquals(120f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_border_only_percent() { 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.setWidthPercent(50f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); 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(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(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(0f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_border_only() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.ALL, 10f); 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); 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); } @Test public void test_box_sizing_border_box_border_only_percent() { 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.setWidthPercent(50f); 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(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(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(0f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_no_padding_no_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); 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); 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); } @Test public void test_box_sizing_border_box_no_padding_no_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); 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); 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); } @Test public void test_box_sizing_content_box_children() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); root.setBorder(YogaEdge.ALL, 10f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); final YogaNode root_child0 = createNode(config); root_child0.setWidth(25f); root_child0.setHeight(25f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); root_child2.setHeight(25f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(25f); root_child3.setHeight(25f); root.addChildAt(root_child3, 3); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(130f, root.getLayoutWidth(), 0.0f); assertEquals(130f, root.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(15f, root_child2.getLayoutX(), 0.0f); assertEquals(65f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(15f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.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(130f, root.getLayoutWidth(), 0.0f); assertEquals(130f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(65f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(90f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_children() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 5); root.setBorder(YogaEdge.ALL, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(25f); root_child0.setHeight(25f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); root_child2.setHeight(25f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(25f); root_child3.setHeight(25f); root.addChildAt(root_child3, 3); 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(15f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(15f, root_child2.getLayoutX(), 0.0f); assertEquals(65f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(15f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.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(60f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(65f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(60f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_siblings() { 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.setWidth(25f); root_child0.setHeight(25f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); root_child1.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child1.setPadding(YogaEdge.ALL, 10); root_child1.setBorder(YogaEdge.ALL, 10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); root_child2.setHeight(25f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(25f); root_child3.setHeight(25f); root.addChildAt(root_child3, 3); 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(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(25f, root_child1.getLayoutY(), 0.0f); assertEquals(65f, root_child1.getLayoutWidth(), 0.0f); assertEquals(65f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(90f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(115f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.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(75f, 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); assertEquals(35f, root_child1.getLayoutX(), 0.0f); assertEquals(25f, root_child1.getLayoutY(), 0.0f); assertEquals(65f, root_child1.getLayoutWidth(), 0.0f); assertEquals(65f, root_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(90f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(75f, root_child3.getLayoutX(), 0.0f); assertEquals(115f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_siblings() { 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.setWidth(25f); root_child0.setHeight(25f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); root_child1.setPadding(YogaEdge.ALL, 10); root_child1.setBorder(YogaEdge.ALL, 10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); root_child2.setHeight(25f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(25f); root_child3.setHeight(25f); root.addChildAt(root_child3, 3); 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(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(25f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(65f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.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(75f, 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); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(25f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(65f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(75f, root_child3.getLayoutX(), 0.0f); assertEquals(90f, root_child3.getLayoutY(), 0.0f); assertEquals(25f, root_child3.getLayoutWidth(), 0.0f); assertEquals(25f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_max_width() { 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.setMaxWidth(50f); root_child0.setHeight(25f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(65f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(65f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_max_width() { 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.setMaxWidth(50f); root_child0.setHeight(25f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_max_height() { 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.setWidth(50f); root_child0.setMaxHeight(50f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_max_height() { 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.setWidth(50f); root_child0.setMaxHeight(50f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_min_width() { 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.setMinWidth(50f); root_child0.setHeight(25f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(65f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(65f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_min_width() { 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.setMinWidth(50f); root_child0.setHeight(25f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_min_height() { 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.setWidth(50f); root_child0.setMinHeight(50f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(90f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(90f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_min_height() { 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.setWidth(50f); root_child0.setMinHeight(50f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 15f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(25f); root_child1.setHeight(25f); 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(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(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, 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(75f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_no_height_no_width() { 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.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 2); root_child0.setBorder(YogaEdge.ALL, 7f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(18f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(18f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_no_height_no_width() { 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.setPadding(YogaEdge.ALL, 2); root_child0.setBorder(YogaEdge.ALL, 7f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(18f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(18f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_nested() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setPadding(YogaEdge.ALL, 15); root.setBorder(YogaEdge.ALL, 3f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 2); root_child0.setBorder(YogaEdge.ALL, 7f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(5f); root_child0_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0_child0.setPadding(YogaEdge.ALL, 1); root_child0_child0.setBorder(YogaEdge.ALL, 2f); root_child0.addChildAt(root_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(136f, root.getLayoutWidth(), 0.0f); assertEquals(136f, root.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0.getLayoutX(), 0.0f); assertEquals(18f, root_child0.getLayoutY(), 0.0f); assertEquals(38f, root_child0.getLayoutWidth(), 0.0f); assertEquals(38f, root_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(16f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(11f, root_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(136f, root.getLayoutWidth(), 0.0f); assertEquals(136f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(18f, root_child0.getLayoutY(), 0.0f); assertEquals(38f, root_child0.getLayoutWidth(), 0.0f); assertEquals(38f, root_child0.getLayoutHeight(), 0.0f); assertEquals(13f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(16f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(11f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_nested() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 15); root.setBorder(YogaEdge.ALL, 3f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setPadding(YogaEdge.ALL, 2); root_child0.setBorder(YogaEdge.ALL, 7f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(5f); root_child0_child0.setPadding(YogaEdge.ALL, 1); root_child0_child0.setBorder(YogaEdge.ALL, 2f); root_child0.addChildAt(root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0.getLayoutX(), 0.0f); assertEquals(18f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(6f, root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(62f, root_child0.getLayoutX(), 0.0f); assertEquals(18f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(1f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(6f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_nested_alternating() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setPadding(YogaEdge.ALL, 3); root.setBorder(YogaEdge.ALL, 2f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root_child0.setHeight(40f); root_child0.setPadding(YogaEdge.ALL, 8); root_child0.setBorder(YogaEdge.ALL, 2f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(20f); root_child0_child0.setHeight(25f); root_child0_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0_child0.setPadding(YogaEdge.ALL, 3); root_child0_child0.setBorder(YogaEdge.ALL, 6f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setWidth(10f); root_child0_child0_child0.setHeight(5f); root_child0_child0_child0.setPadding(YogaEdge.ALL, 1); root_child0_child0_child0.setBorder(YogaEdge.ALL, 1f); root_child0_child0.addChildAt(root_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(110f, root.getLayoutWidth(), 0.0f); assertEquals(110f, root.getLayoutHeight(), 0.0f); assertEquals(5f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(38f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(43f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(5f, root_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(110f, root.getLayoutWidth(), 0.0f); assertEquals(110f, root.getLayoutHeight(), 0.0f); assertEquals(65f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-8f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(38f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(43f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(19f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(5f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_nested_alternating() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 3); root.setBorder(YogaEdge.ALL, 2f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root_child0.setHeight(40f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0.setPadding(YogaEdge.ALL, 8); root_child0.setBorder(YogaEdge.ALL, 2f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(20f); root_child0_child0.setHeight(25f); root_child0_child0.setPadding(YogaEdge.ALL, 3); root_child0_child0.setBorder(YogaEdge.ALL, 6f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setWidth(10f); root_child0_child0_child0.setHeight(5f); root_child0_child0_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root_child0_child0_child0.setPadding(YogaEdge.ALL, 1); root_child0_child0_child0.setBorder(YogaEdge.ALL, 1f); root_child0_child0.addChildAt(root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(5f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(14f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(9f, root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(35f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-3f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(14f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_box_sizing_content_box_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(50f); root_child0.setHeight(25f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 10f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); 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(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(55f, 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(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(55f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(50f); root_child0.setHeight(25f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_box_sizing_content_box_flex_basis_column() { 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.setFlexBasis(50f); root_child0.setHeight(25f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 10f); root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_flex_basis_column() { 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.setFlexBasis(50f); root_child0.setHeight(25f); root_child0.setPadding(YogaEdge.ALL, 5); root_child0.setBorder(YogaEdge.ALL, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_content_box_padding_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.START, 5); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.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(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_padding_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.START, 5); 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); 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); } @Test public void test_box_sizing_content_box_padding_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.END, 5); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.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(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_padding_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.END, 5); 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); 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); } @Test public void test_box_sizing_content_box_border_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.START, 5f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.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(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_border_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.START, 5f); 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); 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); } @Test public void test_box_sizing_content_box_border_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.END, 5f); root.setBoxSizing(YogaBoxSizing.CONTENT_BOX); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.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(105f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); } @Test public void test_box_sizing_border_box_border_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setBorder(YogaEdge.END, 5f); 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); 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); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGDimensionTest.java ================================================ /* * 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<<28226b97f32ae39c8bbf96678867c310>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGDimensionTest.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 YGDimensionTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_wrap_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_wrap_grandchild() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(100f); root_child0_child0.setHeight(100f); root_child0.addChildAt(root_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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGDisplayContentsTest.java ================================================ /* * 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<> * 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 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: java/tests/generated/com/facebook/yoga/YGDisplayTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.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; import com.facebook.yoga.utils.TestUtils; @RunWith(Parameterized.class) public class YGDisplayTest { @Parameterized.Parameters(name = "{0}") public static Iterable 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setDisplay(YogaDisplay.NONE); root_child0.setMargin(YogaEdge.ALL, 10f); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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_child1.setPosition(YogaEdge.TOP, 10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(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.setDisplay(YogaDisplay.NONE); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(100f); root_child0.setHeight(100f); 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); } @Test public void test_display_contents() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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); } @Test public void test_display_contents_fixed_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setDisplay(YogaDisplay.CONTENTS); root_child0.setWidth(50f); root_child0.setHeight(50f); 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); } @Test public void test_display_contents_with_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setDisplay(YogaDisplay.CONTENTS); root_child0.setMargin(YogaEdge.ALL, 10f); 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_contents_with_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setDisplay(YogaDisplay.CONTENTS); root_child0.setPadding(YogaEdge.ALL, 10); 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); } @Test public void test_display_contents_with_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setDisplay(YogaDisplay.CONTENTS); root_child0.setPosition(YogaEdge.TOP, 10f); 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); } @Test public void test_display_contents_with_position_absolute() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setDisplay(YogaDisplay.CONTENTS); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setWidth(50f); root_child0.setHeight(50f); 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); } @Test public void test_display_contents_nested() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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.setDisplay(YogaDisplay.CONTENTS); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setFlexGrow(1f); root_child0_child0_child0.setFlexShrink(1f); root_child0_child0_child0.setFlexBasisPercent(0f); root_child0_child0_child0.setHeight(10f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setFlexGrow(1f); root_child0_child0_child1.setFlexShrink(1f); root_child0_child0_child1.setFlexBasisPercent(0f); root_child0_child0_child1.setHeight(20f); root_child0_child0.addChildAt(root_child0_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(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_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(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_display_contents_with_siblings() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); root_child0.setHeight(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setDisplay(YogaDisplay.CONTENTS); 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.setHeight(10f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setFlexGrow(1f); root_child1_child1.setFlexShrink(1f); root_child1_child1.setFlexBasisPercent(0f); root_child1_child1.setHeight(20f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexGrow(1f); root_child2.setFlexShrink(1f); root_child2.setFlexBasisPercent(0f); root_child2.setHeight(30f); 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(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, 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(25f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, 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(75f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, 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(50f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGFlexBasisFitContentTest.java ================================================ /* * 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<<43053b7b4f9b08ef644e0bb63c44e78f>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexBasisFitContentTest.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 YGFlexBasisFitContentTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_container_child_overflows_definite_parent_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(300f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(500f); root_child0_child0.setWidth(50f); root_child0.addChildAt(root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_container_child_overflows_definite_parent_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(500f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_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(300f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(300f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(-200f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_container_child_within_bounds_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(300f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(50f); root_child0.addChildAt(root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_multiple_container_children_overflow_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(300f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(400f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child1 = createNode(config); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setHeight(500f); root_child1.addChildAt(root_child1_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(400f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(400f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_scroll_container_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(300f); root.setOverflow(YogaOverflow.SCROLL); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(500f); root_child0.addChildAt(root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_explicit_and_container_children_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(300f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setHeight(500f); root_child1.addChildAt(root_child1_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_flex_basis_in_scroll_content_container() { YogaConfig config = YogaConfigFactory.create(); config.setExperimentalFeatureEnabled(YogaExperimentalFeature.FIX_FLEX_BASIS_FIT_CONTENT, true); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(300f); root.setOverflow(YogaOverflow.SCROLL); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexBasis(200f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setFlexBasis(300f); 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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(300f, 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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0_child1.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGFlexDirectionTest.java ================================================ /* * 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<<6cca3f234b902a23ceaa2a5f200d1c13>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexDirectionTest.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 YGFlexDirectionTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_flex_direction_column_no_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(30f, 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(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(30f, 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(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_no_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(30f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(30f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(90f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(70f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(70f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_margin_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setMargin(YogaEdge.LEFT, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_margin_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setMargin(YogaEdge.START, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_margin_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setMargin(YogaEdge.RIGHT, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_margin_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setMargin(YogaEdge.END, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_margin_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setMargin(YogaEdge.TOP, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(100f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(100f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_margin_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setMargin(YogaEdge.BOTTOM, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_padding_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setPadding(YogaEdge.LEFT, 100); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(110f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_padding_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setPadding(YogaEdge.START, 100); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_padding_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setPadding(YogaEdge.RIGHT, 100); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_padding_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setPadding(YogaEdge.END, 100); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(110f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_padding_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setPadding(YogaEdge.TOP, 100); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_padding_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setPadding(YogaEdge.BOTTOM, 100); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(10f, 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(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_border_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setBorder(YogaEdge.LEFT, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(110f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_border_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setBorder(YogaEdge.START, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_border_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setBorder(YogaEdge.RIGHT, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_border_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setBorder(YogaEdge.END, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, 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(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(110f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(120f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_border_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setBorder(YogaEdge.TOP, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_border_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setBorder(YogaEdge.BOTTOM, 100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(10f, 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(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(90f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_pos_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root_child0.setPosition(YogaEdge.LEFT, 100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, 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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_pos_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root_child0.setPosition(YogaEdge.START, 100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, 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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(-100f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_pos_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root_child0.setPosition(YogaEdge.RIGHT, 100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(-100f, 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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(-100f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_pos_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root_child0.setPosition(YogaEdge.END, 100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(-100f, 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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_pos_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root_child0.setPosition(YogaEdge.TOP, 100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_column_reverse_pos_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root_child0.setPosition(YogaEdge.BOTTOM, 100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-100f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-100f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_pos_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPosition(YogaEdge.LEFT, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_pos_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPosition(YogaEdge.RIGHT, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(80f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(80f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_pos_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPosition(YogaEdge.TOP, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_pos_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPosition(YogaEdge.BOTTOM, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_flex_direction_row_reverse_inner_pos_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPosition(YogaEdge.START, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(80f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_flex_direction_row_reverse_inner_pos_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPosition(YogaEdge.END, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(80f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_margin_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setMargin(YogaEdge.LEFT, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_margin_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setMargin(YogaEdge.RIGHT, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(80f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_margin_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setMargin(YogaEdge.TOP, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_margin_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setMargin(YogaEdge.BOTTOM, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_marign_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setMargin(YogaEdge.START, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_margin_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setMargin(YogaEdge.END, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(80f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(10f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_border_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setBorder(YogaEdge.LEFT, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_border_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setBorder(YogaEdge.RIGHT, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_border_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_border_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setBorder(YogaEdge.BOTTOM, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_border_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setBorder(YogaEdge.START, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_border_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setBorder(YogaEdge.END, 10f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_padding_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPadding(YogaEdge.LEFT, 10); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_padding_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPadding(YogaEdge.RIGHT, 10); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_padding_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPadding(YogaEdge.TOP, 10); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_col_reverse_inner_padding_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_padding_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPadding(YogaEdge.START, 10); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_row_reverse_inner_padding_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.setPadding(YogaEdge.END, 10); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(10f); 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(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(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, 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(10f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_direction_alternating_with_percent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(300f); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setHeightPercent(50f); root_child0.setWidthPercent(50f); root_child0.setPositionPercent(YogaEdge.LEFT, 10f); root_child0.setPositionPercent(YogaEdge.TOP, 10f); root_child0.setFlexDirection(YogaFlexDirection.ROW); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(300f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(300f, root.getLayoutHeight(), 0.0f); assertEquals(120f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGFlexTest.java ================================================ /* * 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<<9d423a7b3fce868ebace7ffc938a4aea>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexTest.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 YGFlexTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_flex_basis_flex_grow_column() { 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.setFlexBasis(50f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(75f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(75f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, 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(75f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(75f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_shrink_flex_grow_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(100f); root_child0.setFlexShrink(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(500f); root_child1.setHeight(100f); root_child1.setFlexShrink(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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(250f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(250f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(250f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(250f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(250f, 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(250f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_shrink_flex_grow_child_flex_shrink_other_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(100f); root_child0.setFlexShrink(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(500f); root_child1.setHeight(100f); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(250f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(250f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(250f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(250f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(250f, 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(250f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_basis_flex_grow_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(50f); root_child0.setFlexGrow(1f); 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(75f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, 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(25f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(75f, 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(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_basis_flex_shrink_column() { 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.setFlexBasis(100f); root_child0.setFlexShrink(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexBasis(50f); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_basis_flex_shrink_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(100f); root_child0.setFlexShrink(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexBasis(50f); 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(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(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_shrink_to_zero() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(75f); 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_child1.setFlexShrink(1f); 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(75f, 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(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, 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(75f, 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(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_basis_overrides_main_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(80f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(80f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_shrink_at_most() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_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(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(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_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(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(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_less_than_factor_one() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(0.2f); root_child0.setFlexBasis(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(0.2f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexGrow(0.4f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(132f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(132f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(224f, root_child2.getLayoutY(), 0.0f); assertEquals(200f, root_child2.getLayoutWidth(), 0.0f); assertEquals(184f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(132f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(132f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(224f, root_child2.getLayoutY(), 0.0f); assertEquals(200f, root_child2.getLayoutWidth(), 0.0f); assertEquals(184f, root_child2.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGFlexWrapTest.java ================================================ /* * 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<<42f3bb9cf24632362e8ad90c1e7041ef>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexWrapTest.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 YGFlexWrapTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test @Ignore public void test_wrap_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setHeight(30f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(30f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(30f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(30f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.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(30f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(60f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_wrap_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setHeight(30f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(30f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(30f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); 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(60f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.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(60f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_wrap_row_align_items_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(30f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); 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(60f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.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(60f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_wrap_row_align_items_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(30f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); 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(60f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(5f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.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(60f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(5f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(30f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_flex_wrap_children_with_min_main_overriding_flex_basis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(50f); root_child0.setHeight(50f); root_child0.setMinWidth(55f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexBasis(50f); root_child1.setHeight(50f); root_child1.setMinWidth(55f); 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(55f, 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(55f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(45f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(55f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(45f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(55f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_wrap_wrap_to_child_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setAlignItems(YogaAlign.FLEX_START); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(100f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(100f); root_child0_child0_child0.setWidth(100f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); 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(200f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, 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(200f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_wrap_align_stretch_fits_one_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(150f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); 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(150f, 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(0f, 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(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(150f, root.getLayoutWidth(), 0.0f); assertEquals(100f, 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(0f, 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(0f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_wrap_reverse_row_align_content_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(40f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root_child4.setWidth(30f); root.addChildAt(root_child4, 4); 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(80f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(80f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(40f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_wrap_reverse_row_align_content_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP_REVERSE); root.setAlignContent(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(40f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root_child4.setWidth(30f); root.addChildAt(root_child4, 4); 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(80f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(80f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(40f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_wrap_reverse_row_single_line_different_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(40f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root_child4.setWidth(30f); root.addChildAt(root_child4, 4); 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(50f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(40f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(90f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(120f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(50f, root.getLayoutHeight(), 0.0f); assertEquals(270f, root_child0.getLayoutX(), 0.0f); assertEquals(40f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(240f, root_child1.getLayoutX(), 0.0f); assertEquals(30f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(210f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(180f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(150f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_wrap_reverse_row_align_content_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP_REVERSE); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(40f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root_child4.setWidth(30f); root.addChildAt(root_child4, 4); 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(80f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(80f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(40f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_wrap_reverse_row_align_content_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP_REVERSE); root.setAlignContent(YogaAlign.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(40f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root_child4.setWidth(30f); root.addChildAt(root_child4, 4); 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(80f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.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(80f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(70f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(10f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(40f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_wrap_reverse_column_fixed_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(100f); root.setWrap(YogaWrap.WRAP_REVERSE); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(30f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root_child1.setWidth(30f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); root_child2.setWidth(30f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setHeight(40f); root_child3.setWidth(30f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setHeight(50f); root_child4.setWidth(30f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(170f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(170f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(170f, root_child2.getLayoutX(), 0.0f); assertEquals(30f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(170f, root_child3.getLayoutX(), 0.0f); assertEquals(60f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(140f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(30f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(60f, root_child3.getLayoutY(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_wrapped_row_within_align_items_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(150f); root_child0_child0.setHeight(80f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(80f); root_child0_child1.setHeight(80f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(160f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(80f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(160f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(120f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_wrapped_row_within_align_items_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(150f); root_child0_child0.setHeight(80f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(80f); root_child0_child1.setHeight(80f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(160f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(80f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(160f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(120f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_wrapped_row_within_align_items_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(150f); root_child0_child0.setHeight(80f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(80f); root_child0_child1.setHeight(80f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(160f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(80f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(160f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(120f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_wrapped_column_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); root.setWidth(700f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); root.setAlignContent(YogaAlign.CENTER); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(500f); root_child0.setMaxHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(200f); root_child1.setHeight(200f); root_child1.setMargin(YogaEdge.ALL, 20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); 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(700f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(250f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(200f, root_child1.getLayoutX(), 0.0f); assertEquals(250f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); assertEquals(420f, root_child2.getLayoutX(), 0.0f); assertEquals(200f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, 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(700f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(350f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(300f, root_child1.getLayoutX(), 0.0f); assertEquals(250f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); assertEquals(180f, root_child2.getLayoutX(), 0.0f); assertEquals(200f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_wrapped_column_max_height_flex() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); root.setWidth(700f); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); root.setAlignContent(YogaAlign.CENTER); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(500f); root_child0.setMaxHeight(200f); 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.setWidth(200f); root_child1.setHeight(200f); root_child1.setMargin(YogaEdge.ALL, 20f); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(1f); root_child1.setFlexBasisPercent(0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); 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(700f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(300f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(180f, root_child0.getLayoutHeight(), 0.0f); assertEquals(250f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(180f, root_child1.getLayoutHeight(), 0.0f); assertEquals(300f, root_child2.getLayoutX(), 0.0f); assertEquals(400f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, 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(700f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(300f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(180f, root_child0.getLayoutHeight(), 0.0f); assertEquals(250f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(180f, root_child1.getLayoutHeight(), 0.0f); assertEquals(300f, root_child2.getLayoutX(), 0.0f); assertEquals(400f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_wrap_nodes_with_content_sizing_overflowing_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setWidth(85f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(40f); root_child0_child0_child0.setWidth(40f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setMargin(YogaEdge.RIGHT, 10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child1_child0 = createNode(config); root_child0_child1_child0.setHeight(40f); root_child0_child1_child0.setWidth(40f); root_child0_child1.addChildAt(root_child0_child1_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(85f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0_child1_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(415f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(85f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); assertEquals(45f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(35f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_wrap_nodes_with_content_sizing_margin_cross() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWrap(YogaWrap.WRAP); root_child0.setWidth(70f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(40f); root_child0_child0_child0.setWidth(40f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setMargin(YogaEdge.TOP, 10f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child1_child0 = createNode(config); root_child0_child1_child0.setHeight(40f); root_child0_child1_child0.setWidth(40f); root_child0_child1.addChildAt(root_child0_child1_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(70f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0_child1_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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(430f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(70f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(40f, 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(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f); } @Test public void test_wrap_with_min_cross_axis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMinHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_wrap_with_max_cross_axis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setMaxHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(400f); root_child1.setHeight(200f); 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(500f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(400f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(400f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_nowrap_expands_flexline_box_to_min_cross() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(400f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); 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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(400f, 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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_wrap_does_not_impose_min_cross_onto_single_flexline() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(400f); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); 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(0f, 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(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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGGapTest.java ================================================ /* * 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<<1bf35956f67606a5ecbce54bba0b41df>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGGapTest.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 YGGapTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_column_gap_flexible() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(80f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); 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.addChildAt(root_child1, 1); 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(80f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_inflexible() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(80f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(80f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_mixed_flexible() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(80f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(1f); root_child1.setFlexBasisPercent(0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(80f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_child_margins() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(80f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); root_child0.setMargin(YogaEdge.HORIZONTAL, 2f); 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.setMargin(YogaEdge.HORIZONTAL, 10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexGrow(1f); root_child2.setFlexShrink(1f); root_child2.setFlexBasisPercent(0f); root_child2.setMargin(YogaEdge.HORIZONTAL, 15f); 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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(2f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(26f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(2f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(63f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(2f, 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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(76f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(52f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(2f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(15f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(2f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_row_gap_wrapping() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(80f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root_child4.setHeight(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root_child5.setHeight(20f); root.addChildAt(root_child5, 5); final YogaNode root_child6 = createNode(config); root_child6.setWidth(20f); root_child6.setHeight(20f); root.addChildAt(root_child6, 6); final YogaNode root_child7 = createNode(config); root_child7.setWidth(20f); root_child7.setHeight(20f); root.addChildAt(root_child7, 7); final YogaNode root_child8 = createNode(config); root_child8.setWidth(20f); root_child8.setHeight(20f); root.addChildAt(root_child8, 8); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(80f, 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(40f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(40f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(40f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); assertEquals(0f, root_child6.getLayoutX(), 0.0f); assertEquals(80f, root_child6.getLayoutY(), 0.0f); assertEquals(20f, root_child6.getLayoutWidth(), 0.0f); assertEquals(20f, root_child6.getLayoutHeight(), 0.0f); assertEquals(30f, root_child7.getLayoutX(), 0.0f); assertEquals(80f, root_child7.getLayoutY(), 0.0f); assertEquals(20f, root_child7.getLayoutWidth(), 0.0f); assertEquals(20f, root_child7.getLayoutHeight(), 0.0f); assertEquals(60f, root_child8.getLayoutX(), 0.0f); assertEquals(80f, root_child8.getLayoutY(), 0.0f); assertEquals(20f, root_child8.getLayoutWidth(), 0.0f); assertEquals(20f, root_child8.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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(60f, root_child3.getLayoutX(), 0.0f); assertEquals(40f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(40f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(0f, root_child5.getLayoutX(), 0.0f); assertEquals(40f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); assertEquals(60f, root_child6.getLayoutX(), 0.0f); assertEquals(80f, root_child6.getLayoutY(), 0.0f); assertEquals(20f, root_child6.getLayoutWidth(), 0.0f); assertEquals(20f, root_child6.getLayoutHeight(), 0.0f); assertEquals(30f, root_child7.getLayoutX(), 0.0f); assertEquals(80f, root_child7.getLayoutY(), 0.0f); assertEquals(20f, root_child7.getLayoutWidth(), 0.0f); assertEquals(20f, root_child7.getLayoutHeight(), 0.0f); assertEquals(0f, root_child8.getLayoutX(), 0.0f); assertEquals(80f, root_child8.getLayoutY(), 0.0f); assertEquals(20f, root_child8.getLayoutWidth(), 0.0f); assertEquals(20f, root_child8.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_start_index() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(80f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(80f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(60f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.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(80f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_justify_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_justify_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.CENTER); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(70f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(70f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_justify_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.FLEX_END); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(60f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_justify_space_between() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_BETWEEN); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_justify_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_AROUND); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(3f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(77f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(77f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(3f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_justify_space_evenly() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_EVENLY); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(5f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(75f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(5f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_wrap_align_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root_child4.setHeight(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root_child5.setHeight(20f); root.addChildAt(root_child5, 5); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(40f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(40f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(40f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(40f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(40f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(40f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_wrap_align_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.CENTER); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root_child4.setHeight(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root_child5.setHeight(20f); root.addChildAt(root_child5, 5); 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(20f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(60f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(60f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(60f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.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(20f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(60f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(60f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(60f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_wrap_align_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.FLEX_END); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root_child4.setHeight(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root_child5.setHeight(20f); root.addChildAt(root_child5, 5); 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(40f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(80f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.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(40f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(40f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(40f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(80f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_wrap_align_space_between() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_BETWEEN); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root_child4.setHeight(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root_child5.setHeight(20f); root.addChildAt(root_child5, 5); 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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(80f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.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(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(80f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(80f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(80f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_wrap_align_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setAlignContent(YogaAlign.SPACE_AROUND); root.setWidth(100f); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root_child2.setHeight(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root_child3.setHeight(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root_child4.setHeight(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root_child5.setHeight(20f); root.addChildAt(root_child5, 5); 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(10f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(70f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(70f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(70f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(10f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(70f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(20f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(70f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(20f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(70f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(20f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_wrap_align_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(300f); root.setHeight(300f); root.setGap(YogaGutter.COLUMN, 5f); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setMinWidth(60f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setMinWidth(60f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setMinWidth(60f); root_child2.setFlexGrow(1f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setMinWidth(60f); root_child3.setFlexGrow(1f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setMinWidth(60f); root_child4.setFlexGrow(1f); root.addChildAt(root_child4, 4); 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(71f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(76f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(72f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); assertEquals(153f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(71f, root_child2.getLayoutWidth(), 0.0f); assertEquals(150f, root_child2.getLayoutHeight(), 0.0f); assertEquals(229f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(71f, root_child3.getLayoutWidth(), 0.0f); assertEquals(150f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(150f, root_child4.getLayoutY(), 0.0f); assertEquals(300f, root_child4.getLayoutWidth(), 0.0f); assertEquals(150f, root_child4.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(229f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(71f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(153f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(71f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); assertEquals(76f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(72f, root_child2.getLayoutWidth(), 0.0f); assertEquals(150f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(71f, root_child3.getLayoutWidth(), 0.0f); assertEquals(150f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(150f, root_child4.getLayoutY(), 0.0f); assertEquals(300f, root_child4.getLayoutWidth(), 0.0f); assertEquals(150f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_column_gap_determines_parent_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setHeight(100f); root.setGap(YogaGutter.COLUMN, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(30f); 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(80f, 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(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, 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(80f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(70f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_align_items_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(200f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root.addChildAt(root_child5, 5); 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(90f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(90f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(110f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(90f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(110f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(90f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(110f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(90f, root_child5.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(200f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(90f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(90f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(110f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(90f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(110f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(90f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(110f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(90f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_align_items_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(200f); root.setGap(YogaGutter.COLUMN, 10f); root.setGap(YogaGutter.ROW, 20f); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(20f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(20f); root.addChildAt(root_child4, 4); final YogaNode root_child5 = createNode(config); root_child5.setWidth(20f); root.addChildAt(root_child5, 5); 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(0f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child4.getLayoutX(), 0.0f); assertEquals(20f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); assertEquals(60f, root_child5.getLayoutX(), 0.0f); assertEquals(20f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(0f, root_child5.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(200f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); assertEquals(80f, root_child3.getLayoutX(), 0.0f); assertEquals(20f, root_child3.getLayoutY(), 0.0f); assertEquals(20f, root_child3.getLayoutWidth(), 0.0f); assertEquals(0f, root_child3.getLayoutHeight(), 0.0f); assertEquals(50f, root_child4.getLayoutX(), 0.0f); assertEquals(20f, root_child4.getLayoutY(), 0.0f); assertEquals(20f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); assertEquals(20f, root_child5.getLayoutX(), 0.0f); assertEquals(20f, root_child5.getLayoutY(), 0.0f); assertEquals(20f, root_child5.getLayoutWidth(), 0.0f); assertEquals(0f, root_child5.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_column_child_margins() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(200f); root.setGap(YogaGutter.ROW, 10f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); root_child0.setMargin(YogaEdge.VERTICAL, 2f); 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.setMargin(YogaEdge.VERTICAL, 10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexGrow(1f); root_child2.setFlexShrink(1f); root_child2.setFlexBasisPercent(0f); root_child2.setMargin(YogaEdge.VERTICAL, 15f); 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(2f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(42f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(66f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(42f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(143f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(42f, 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(2f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(42f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(66f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(42f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(143f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(42f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_row_wrap_child_margins() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(200f); root.setGap(YogaGutter.ROW, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(60f); root_child0.setMargin(YogaEdge.VERTICAL, 2f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(60f); root_child1.setMargin(YogaEdge.VERTICAL, 10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(60f); root_child2.setMargin(YogaEdge.VERTICAL, 15f); 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(2f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(24f, root_child1.getLayoutY(), 0.0f); assertEquals(60f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(59f, root_child2.getLayoutY(), 0.0f); assertEquals(60f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(40f, root_child0.getLayoutX(), 0.0f); assertEquals(2f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(24f, root_child1.getLayoutY(), 0.0f); assertEquals(60f, root_child1.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(59f, root_child2.getLayoutY(), 0.0f); assertEquals(60f, root_child2.getLayoutWidth(), 0.0f); assertEquals(0f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_determines_parent_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setGap(YogaGutter.ROW, 10f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(30f); 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(80f, 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(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, 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(80f, 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(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(20f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(50f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(700f); root.setPadding(YogaEdge.ALL, 10); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root.addChildAt(root_child4, 4); 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(700f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(138f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(138f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(700f, root.getLayoutHeight(), 0.0f); assertEquals(190f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(62f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(190f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(62f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(190f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_determines_parent_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root.addChildAt(root_child4, 4); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(130f, 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); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(130f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(200f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(200f, 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(70f, 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); assertEquals(200f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(200f, root_child4.getLayoutX(), 0.0f); assertEquals(200f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping_with_both_content_padding_and_item_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(700f); root.setPadding(YogaEdge.ALL, 10); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root_child1.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root_child2.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root_child3.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root_child4.setPadding(YogaEdge.ALL, 10); root.addChildAt(root_child4, 4); 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(700f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(138f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(138f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(700f, root.getLayoutHeight(), 0.0f); assertEquals(190f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(62f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(190f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(62f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(190f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping_with_both_content_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(700f); root.setPadding(YogaEdge.ALL, 10); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root.addChildAt(root_child4, 4); 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(700f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(138f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(138f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(700f, root.getLayoutHeight(), 0.0f); assertEquals(190f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(62f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(190f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(62f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(190f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping_with_content_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(700f); root.setMargin(YogaEdge.ALL, 10f); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutY(), 0.0f); assertEquals(300f, root.getLayoutWidth(), 0.0f); assertEquals(700f, 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(130f, 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); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(170f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(130f, root_child3.getLayoutX(), 0.0f); assertEquals(170f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(340f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutY(), 0.0f); assertEquals(300f, root.getLayoutWidth(), 0.0f); assertEquals(700f, root.getLayoutHeight(), 0.0f); assertEquals(200f, 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(70f, 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); assertEquals(200f, root_child2.getLayoutX(), 0.0f); assertEquals(170f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(170f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(200f, root_child4.getLayoutX(), 0.0f); assertEquals(340f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping_with_content_margin_and_padding() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(700f); root.setMargin(YogaEdge.ALL, 10f); root.setPadding(YogaEdge.ALL, 10); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutY(), 0.0f); assertEquals(300f, root.getLayoutWidth(), 0.0f); assertEquals(700f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(138f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(138f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutY(), 0.0f); assertEquals(300f, root.getLayoutWidth(), 0.0f); assertEquals(700f, root.getLayoutHeight(), 0.0f); assertEquals(190f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(62f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(190f, root_child2.getLayoutX(), 0.0f); assertEquals(178f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(62f, root_child3.getLayoutX(), 0.0f); assertEquals(178f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(190f, root_child4.getLayoutX(), 0.0f); assertEquals(346f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping_with_flexible_content() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(300f); root.setGapPercent(YogaGutter.ALL, 10f); 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.addChildAt(root_child1, 1); 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(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(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(110f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child1.getLayoutWidth(), 0.0f); assertEquals(300f, root_child1.getLayoutHeight(), 0.0f); assertEquals(220f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(80f, root_child2.getLayoutWidth(), 0.0f); assertEquals(300f, 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(220f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(110f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child1.getLayoutWidth(), 0.0f); assertEquals(300f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(80f, root_child2.getLayoutWidth(), 0.0f); assertEquals(300f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_row_gap_percent_wrapping_with_mixed_flexible_content() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(300f); root.setHeight(300f); root.setGapPercent(YogaGutter.ALL, 10f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root_child1.setFlexShrink(1f); root_child1.setFlexBasisPercent(0f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidthPercent(10f); 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(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(300f, root_child1.getLayoutHeight(), 0.0f); assertEquals(270f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(300f, 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(290f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(300f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(300f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_row_gap_percent_wrapping_with_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMinWidth(300f); root.setGapPercent(YogaGutter.ALL, 10f); root.setWrap(YogaWrap.WRAP); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(100f); root_child1.setHeight(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); root_child2.setHeight(100f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setWidth(100f); root_child3.setHeight(100f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setWidth(100f); root_child4.setHeight(100f); root.addChildAt(root_child4, 4); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(130f, 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); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(130f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(200f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(200f, 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(70f, 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); assertEquals(200f, root_child2.getLayoutX(), 0.0f); assertEquals(100f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(70f, root_child3.getLayoutX(), 0.0f); assertEquals(100f, root_child3.getLayoutY(), 0.0f); assertEquals(100f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(200f, root_child4.getLayoutX(), 0.0f); assertEquals(200f, root_child4.getLayoutY(), 0.0f); assertEquals(100f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java ================================================ /* * 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<<4f4bde7775299127acc8a118ff1a9c74>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGIntrinsicSizeTest.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 YGIntrinsicSizeTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_contains_inner_text_long_word() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); root_child0.setData("LoremipsumdolorsitametconsecteturadipiscingelitSedeleifasdfettortoracauctorFuscerhoncusipsumtemporerosaliquamconsequatPraesentsoda"); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1300f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(700f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1300f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_no_width_no_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(70f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(70f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_no_width_no_height_long_word_in_paragraph() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(70f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(70f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_fixed_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWidth(100f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, 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(1290f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(1900f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(1290f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_no_width_fixed_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_fixed_width_fixed_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWidth(50f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, 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(20f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(1950f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_max_width_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidth(50f); root_child0.setMaxHeight(20f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, 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(20f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(1950f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_max_width_max_height_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setMaxWidth(50f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(1890f, 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(1890f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(1890f, root.getLayoutHeight(), 0.0f); assertEquals(1950f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(1890f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidth(100f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, 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(1290f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(1900f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(1290f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_fixed_width_shorter_text() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWidth(100f); root.addChildAt(root_child0, 0); root_child0.setData("Lorem ipsum"); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, 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(20f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(1900f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_fixed_height_shorter_text() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); root_child0.setData("Lorem ipsum"); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(110f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(1890f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(110f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_contains_inner_text_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(2000f); root.setHeight(2000f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxHeight(20f); root.addChildAt(root_child0, 0); root_child0.setData("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."); root_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(2000f, root.getLayoutWidth(), 0.0f); assertEquals(2000f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(2000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_max_content_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidthMaxContent(); root.setWrap(YogaWrap.WRAP); 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(100f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); 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(175f, 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(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, 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(175f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(125f, 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(25f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, 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(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWidthFitContent(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(90f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, 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(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(75f, 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); } @Test public void test_stretch_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setWidthStretch(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_max_content_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeightMaxContent(); root.setWrap(YogaWrap.WRAP); 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(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(25f); 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(175f, 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(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(175f, 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(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); root_child0.setHeightFitContent(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_stretch_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setHeightStretch(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_max_content_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexBasisMaxContent(); root.setWrap(YogaWrap.WRAP); 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(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(25f); 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(175f, 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(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(175f, 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(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasisFitContent(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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(175f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test public void test_stretch_flex_basis_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasisStretch(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(175f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(175f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_max_content_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setFlexBasisMaxContent(); root.setWrap(YogaWrap.WRAP); 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(100f); root_child1.setHeight(500f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(600f, 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(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(550f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, 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(100f, root.getLayoutWidth(), 0.0f); assertEquals(600f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(500f, root_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(550f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setFlexBasisFitContent(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(90f, 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, 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(90f, 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(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(65f, 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); } @Test @Ignore public void test_stretch_flex_basis_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setFlexBasisStretch(); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_max_content_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMaxWidthMaxContent(); root.setWidth(200f); root.setWrap(YogaWrap.WRAP); 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(100f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); 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(175f, 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(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, 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(175f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(125f, 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(25f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, 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(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidthFitContent(); root_child0.setWidth(110f); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(90f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, 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(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(75f, 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); } @Test @Ignore public void test_stretch_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidthStretch(); root_child0.setWidth(600f); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_max_content_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMinWidthMaxContent(); root.setWidth(100f); root.setWrap(YogaWrap.WRAP); 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(100f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(25f); 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(175f, 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(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, 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(175f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(125f, 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(25f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, 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(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(90f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMinWidthFitContent(); root_child0.setWidth(90f); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(90f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, 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(90f, root.getLayoutWidth(), 0.0f); assertEquals(150f, root.getLayoutHeight(), 0.0f); assertEquals(-10f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(75f, 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); } @Test @Ignore public void test_stretch_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMinWidthStretch(); root_child0.setWidth(400f); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(100f); root_child0_child1.setHeight(50f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, 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(500f, 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(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_max_content_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxHeightMaxContent(); root.setHeight(200f); root.setWrap(YogaWrap.WRAP); 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(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(25f); 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(175f, 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(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(175f, 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(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); root_child0.setMaxHeightFitContent(); root_child0.setHeight(110f); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-100f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_stretch_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setMaxHeightStretch(); root_child0.setWrap(YogaWrap.WRAP); root_child0.setHeight(600f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_max_content_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeightMaxContent(); root.setHeight(100f); root.setWrap(YogaWrap.WRAP); 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(100f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(50f); root_child2.setHeight(25f); 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(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(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(100f, 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(25f, 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(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(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(100f, 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(25f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_fit_content_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(90f); final YogaNode root_child0 = createNode(config); root_child0.setMinHeightFitContent(); root_child0.setHeight(90f); root_child0.setWrap(YogaWrap.WRAP); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(90f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-100f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_stretch_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setMinHeightStretch(); root_child0.setWrap(YogaWrap.WRAP); root_child0.setHeight(400f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(100f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setWidth(50f); root_child0_child2.setHeight(25f); 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(50f, root.getLayoutWidth(), 0.0f); assertEquals(500f, 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(500f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_max_content_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setWidthMaxContent(); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1140f, 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(1140f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(-940f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1140f, 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(1140f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_stretch_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setWidthStretch(); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_fit_content_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setWidthFitContent(); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(-670f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_max_content_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setMinWidthMaxContent(); root_child0.setWidth(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1140f, 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(1140f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(-940f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1140f, 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(1140f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_stretch_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setMinWidthStretch(); root_child0.setWidth(100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_fit_content_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setMinWidthFitContent(); root_child0.setWidth(300f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(-670f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_max_content_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setMaxWidthMaxContent(); root_child0.setWidth(2000f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1140f, 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(1140f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(-940f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1140f, 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(1140f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_stretch_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setMaxWidthStretch(); root_child0.setWidth(300f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_text_fit_content_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setMaxWidthFitContent(); root_child0.setWidth(1000f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.addChildAt(root_child0_child0, 0); root_child0_child0.setData("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"); root_child0_child0.setMeasureFunction(new TestUtils.intrinsicMeasureFunction()); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(-670f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(870f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(30f, root_child0_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGJustifyContentTest.java ================================================ /* * 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<<8153ff1a843e9f95e5cc8c0243e582bc>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGJustifyContentTest.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 YGJustifyContentTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_justify_content_row_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(92f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(82f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(72f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(72f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(82f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(92f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(36f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(56f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(56f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(36f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_space_between() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_BETWEEN); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(92f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(92f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(12f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(80f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, 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(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(102f, root_child1.getLayoutHeight(), 0.0f); assertEquals(12f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(10f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(20f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setJustifyContent(YogaJustify.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(72f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(82f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(92f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(72f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(82f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(92f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(36f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(56f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(36f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(56f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_space_between() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setJustifyContent(YogaJustify.SPACE_BETWEEN); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(92f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(92f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setJustifyContent(YogaJustify.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(12f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(80f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(12f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(80f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_min_width_and_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(50f); root.setMargin(YogaEdge.LEFT, 100f); root.setJustifyContent(YogaJustify.CENTER); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(50f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_max_width_and_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setMaxWidth(80f); root.setMargin(YogaEdge.LEFT, 100f); root.setJustifyContent(YogaJustify.CENTER); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(80f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(100f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(80f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_min_height_and_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(50f); root.setMargin(YogaEdge.TOP, 100f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(100f, root.getLayoutY(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(100f, root.getLayoutY(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(15f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_max_height_and_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setMaxHeight(80f); root.setMargin(YogaEdge.TOP, 100f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(100f, root.getLayoutY(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(80f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(100f, root.getLayoutY(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(80f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(30f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_column_space_evenly() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setJustifyContent(YogaJustify.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(18f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(74f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(18f, root_child0.getLayoutY(), 0.0f); assertEquals(102f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(46f, root_child1.getLayoutY(), 0.0f); assertEquals(102f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(74f, root_child2.getLayoutY(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_row_space_evenly() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setJustifyContent(YogaJustify.SPACE_EVENLY); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(26f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(51f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(77f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(0f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(77f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(51f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(26f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(0f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_min_width_with_padding_child_width_greater_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(1000f); root.setHeight(1584f); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setAlignContent(YogaAlign.STRETCH); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0.setJustifyContent(YogaJustify.CENTER); root_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0.setMinWidth(400f); root_child0_child0.setPadding(YogaEdge.LEFT, 100); root_child0_child0.setPadding(YogaEdge.RIGHT, 100); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(100f); root_child0_child0_child0.setWidth(300f); root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0.addChildAt(root_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(1000f, root.getLayoutWidth(), 0.0f); assertEquals(1584f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(300f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(1000f, root.getLayoutWidth(), 0.0f); assertEquals(1584f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1000f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(300f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_min_width_with_padding_child_width_lower_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(1080f); root.setHeight(1584f); root.setAlignContent(YogaAlign.STRETCH); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setAlignContent(YogaAlign.STRETCH); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0.setJustifyContent(YogaJustify.CENTER); root_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0.setMinWidth(400f); root_child0_child0.setPadding(YogaEdge.LEFT, 100); root_child0_child0.setPadding(YogaEdge.RIGHT, 100); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(100f); root_child0_child0_child0.setWidth(199f); root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH); root_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0.addChildAt(root_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(1080f, root.getLayoutWidth(), 0.0f); assertEquals(1584f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(101f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(199f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(1080f, root.getLayoutWidth(), 0.0f); assertEquals(1584f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(680f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(400f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(101f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(199f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_space_between_indefinite_container_dim_with_free_space() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(300f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMinWidth(200f); root_child0.setJustifyContent(YogaJustify.SPACE_BETWEEN); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(50f); root_child0_child0.setHeight(50f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); root_child0_child1.setHeight(50f); 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(300f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(300f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_flex_start_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_flex_end_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(20f); 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(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(40f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_overflow_row_flex_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(-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); } @Test public void test_justify_content_overflow_row_flex_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(-18f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(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(62f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(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(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_overflow_row_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(-9f, 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(31f, 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(71f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(71f, 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(31f, 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(-9f, 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 public void test_justify_content_overflow_row_space_between() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_BETWEEN); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(-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); } @Test public void test_justify_content_overflow_row_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(-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); } @Test public void test_justify_content_overflow_row_space_evenly() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(-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); } @Test @Ignore public void test_justify_content_overflow_row_reverse_space_around() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setJustifyContent(YogaJustify.SPACE_AROUND); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(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(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(-18f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(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(62f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_justify_content_overflow_row_reverse_space_evenly() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setJustifyContent(YogaJustify.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(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(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 0.0f); assertEquals(-18f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); assertEquals(102f, root_child0.getLayoutHeight(), 0.0f); assertEquals(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(62f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_overflow_row_space_evenly_auto_margin() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(102f); root.setHeight(102f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.SPACE_EVENLY); final YogaNode root_child0 = createNode(config); root_child0.setWidth(40f); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(40f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidth(40f); 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(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(102f, root.getLayoutWidth(), 0.0f); assertEquals(102f, root.getLayoutHeight(), 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(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(-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); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGMarginTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGMarginTest.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 YGMarginTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_margin_start() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setMargin(YogaEdge.START, 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(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_top() { 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.setHeight(10f); root_child0.setMargin(YogaEdge.TOP, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setJustifyContent(YogaJustify.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setMargin(YogaEdge.END, 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(100f, 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(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setJustifyContent(YogaJustify.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setMargin(YogaEdge.BOTTOM, 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(80f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, 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(0f, root_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_and_flex_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.START, 10f); root_child0.setMargin(YogaEdge.END, 10f); root_child0.setFlexGrow(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(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(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_and_flex_column() { 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.setMargin(YogaEdge.TOP, 10f); root_child0.setMargin(YogaEdge.BOTTOM, 10f); root_child0.setFlexGrow(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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_and_stretch_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 10f); root_child0.setMargin(YogaEdge.BOTTOM, 10f); root_child0.setFlexGrow(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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_and_stretch_column() { 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.setMargin(YogaEdge.START, 10f); root_child0.setMargin(YogaEdge.END, 10f); root_child0.setFlexGrow(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(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(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_with_sibling_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.END, 10f); root_child0.setFlexGrow(1f); 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(45f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(55f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(45f, 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(55f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(45f, 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(45f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_with_sibling_column() { 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.setMargin(YogaEdge.BOTTOM, 10f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(45f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(45f, 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(45f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(55f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(45f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.BOTTOM); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.TOP); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_bottom_and_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.TOP); root_child0.setMarginAuto(YogaEdge.BOTTOM); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_bottom_and_top_justify_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.TOP); root_child0.setMarginAuto(YogaEdge.BOTTOM); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, 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(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_multiple_children_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.TOP); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root_child1.setMarginAuto(YogaEdge.TOP); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(25f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(25f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(100f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(75f, root_child2.getLayoutX(), 0.0f); assertEquals(150f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_multiple_children_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root_child1.setMarginAuto(YogaEdge.RIGHT); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(75f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(150f, root_child2.getLayoutX(), 0.0f); assertEquals(75f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(125f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, 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(75f, 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(75f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_left_and_right_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.LEFT); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, 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(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, 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(75f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_left_and_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.LEFT); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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(150f, 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); } @Test public void test_margin_auto_start_and_end_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.START); root_child0.setMarginAuto(YogaEdge.END); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, 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(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, 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(75f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_start_and_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.START); root_child0.setMarginAuto(YogaEdge.END); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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(150f, 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); } @Test public void test_margin_auto_left_and_right_column_and_center() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.LEFT); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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(75f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, 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(75f, 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); } @Test public void test_margin_auto_left() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.LEFT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, 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(75f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, 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(75f, 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); } @Test public void test_margin_auto_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, 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); } @Test public void test_margin_auto_left_and_right_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.LEFT); root_child0.setMarginAuto(YogaEdge.RIGHT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(50f, 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(150f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(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(0f, 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); } @Test public void test_margin_auto_top_and_bottom_stretch() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(50f); root_child0.setMarginAuto(YogaEdge.TOP); root_child0.setMarginAuto(YogaEdge.BOTTOM); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, 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(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_should_not_be_part_of_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(250f); root.setHeight(250f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setMaxHeight(100f); root_child0.setMargin(YogaEdge.TOP, 20f); 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(250f, root.getLayoutWidth(), 0.0f); assertEquals(250f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(250f, root.getLayoutWidth(), 0.0f); assertEquals(250f, root.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_should_not_be_part_of_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(250f); root.setHeight(250f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setMaxWidth(100f); root_child0.setMargin(YogaEdge.LEFT, 20f); 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(250f, root.getLayoutWidth(), 0.0f); assertEquals(250f, root.getLayoutHeight(), 0.0f); assertEquals(20f, 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); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(250f, root.getLayoutWidth(), 0.0f); assertEquals(250f, root.getLayoutHeight(), 0.0f); assertEquals(150f, 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); } @Test public void test_margin_auto_left_right_child_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(72f); root_child0.setHeight(72f); root_child0.setMarginAuto(YogaEdge.LEFT); root_child0.setMarginAuto(YogaEdge.RIGHT); 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_left_child_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(72f); root_child0.setHeight(72f); root_child0.setMarginAuto(YogaEdge.LEFT); 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_fix_left_auto_right_child_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(72f); root_child0.setHeight(72f); root_child0.setMargin(YogaEdge.LEFT, 10f); root_child0.setMarginAuto(YogaEdge.RIGHT); 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-20f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_left_fix_right_child_bigger_than_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(52f); root.setWidth(52f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(72f); root_child0.setHeight(72f); root_child0.setMarginAuto(YogaEdge.LEFT); root_child0.setMargin(YogaEdge.RIGHT, 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, 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(52f, root.getLayoutWidth(), 0.0f); assertEquals(52f, root.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child0.getLayoutX(), 0.0f); assertEquals(-10f, root_child0.getLayoutY(), 0.0f); assertEquals(72f, root_child0.getLayoutWidth(), 0.0f); assertEquals(72f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_top_stretching_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); root_child0.setMarginAuto(YogaEdge.TOP); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_left_stretching_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root_child0.setFlexBasisPercent(0f); root_child0.setMarginAuto(YogaEdge.LEFT); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(200f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(200f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_margin_auto_overflowing_container() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(50f); root_child0.setHeight(150f); root_child0.setMarginAuto(YogaEdge.BOTTOM); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); root_child1.setHeight(150f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(150f, root_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child1.getLayoutX(), 0.0f); assertEquals(150f, root_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGMinMaxDimensionTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGMinMaxDimensionTest.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 YGMinMaxDimensionTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_max_width() { 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.setHeight(10f); root_child0.setMaxWidth(50f); 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(50f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setMaxHeight(50f); 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(50f, 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(50f, root_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_min_height() { 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.setFlexGrow(1f); root_child0.setMinHeight(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(60f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setMinWidth(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(40f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_min_max() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxHeight(200f); root.setMinHeight(100f); root.setWidth(100f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(60f); root_child0.setHeight(60f); 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(20f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, 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(40f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_align_items_min_max() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxWidth(200f); root.setMinWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setWidth(60f); root_child0.setHeight(60f); 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(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, 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(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_justify_content_overflow_min_max() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(100f); root.setMaxHeight(110f); root.setJustifyContent(YogaJustify.CENTER); 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(110f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-20f, 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(30f, 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(80f, 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(110f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(-20f, 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(30f, 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(80f, root_child2.getLayoutY(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_to_min() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(100f); root.setMaxHeight(500f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexShrink(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(50f); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_in_at_most_container() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); root.setAlignItems(YogaAlign.FLEX_START); 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.setFlexGrow(1f); root_child0_child0.setFlexBasis(0f); root_child0.addChildAt(root_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(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(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, 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(0f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(0f); 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(0f, 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(100f, 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(0f, 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(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_constrained_min_max_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(100f); root.setMaxHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(50f); 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(0f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(0f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidth(100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(20f); root_child0_child0.setFlexGrow(1f); root_child0.addChildAt(root_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(200f, 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(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_constrained_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidth(300f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(20f); root_child0_child0.setFlexGrow(1f); root_child0.addChildAt(root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_flex_root_ignored() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setMinHeight(100f); root.setMaxHeight(500f); root.setFlexGrow(1f); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(200f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(100f); 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(300f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, 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(300f, 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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(200f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_root_minimized() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setMinHeight(100f); root.setMaxHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setMinHeight(100f); root_child0.setMaxHeight(500f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexBasis(200f); root_child0_child0.setFlexGrow(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setHeight(100f); 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(300f, 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(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, 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); 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(300f, 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(300f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, 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); } @Test public void test_flex_grow_height_maximized() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(500f); final YogaNode root_child0 = createNode(config); root_child0.setMinHeight(100f); root_child0.setMaxHeight(500f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexBasis(200f); root_child0_child0.setFlexGrow(1f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setHeight(100f); 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(500f, 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(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(400f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, 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(500f, 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(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(400f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(400f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_constrained_min_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(50f); 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(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(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(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(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_constrained_min_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(50f); 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(0f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(0f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(0f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_constrained_max_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setMaxWidth(100f); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexShrink(1f); root_child0_child0.setFlexBasis(100f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidth(50f); 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(200f, 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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(100f, 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(50f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_flex_grow_within_constrained_max_column() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexShrink(1f); root_child0.setFlexBasis(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(50f); 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_child_min_max_width_flexing() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(120f); root.setHeight(50f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setMinWidth(60f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(0f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setMaxWidth(20f); root_child1.setFlexGrow(1f); root_child1.setFlexBasisPercent(50f); 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(120f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(120f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_min_width_overrides_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(100f); root.setWidth(50f); 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(0f, root.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(0f, root.getLayoutHeight(), 0.0f); } @Test public void test_max_width_overrides_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxWidth(100f); root.setWidth(200f); 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(0f, root.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(0f, root.getLayoutHeight(), 0.0f); } @Test public void test_min_height_overrides_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinHeight(100f); root.setHeight(50f); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(0f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.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(0f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); } @Test public void test_max_height_overrides_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxHeight(100f); root.setHeight(200f); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(0f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.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(0f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); } @Test public void test_min_max_percent_no_width_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setMinWidthPercent(10f); root_child0.setMaxWidthPercent(10f); root_child0.setMinHeightPercent(10f); root_child0.setMaxHeightPercent(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); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGPaddingTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGPaddingTest.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 YGPaddingTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_padding_no_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setPadding(YogaEdge.ALL, 10); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.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(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); } @Test public void test_padding_container_match_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setPadding(YogaEdge.ALL, 10); final YogaNode root_child0 = createNode(config); 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(30f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, 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(30f, root.getLayoutWidth(), 0.0f); assertEquals(30f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_padding_flex_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 10); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setFlexGrow(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(100f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_padding_stretch_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.ALL, 10); final YogaNode root_child0 = createNode(config); 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, 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(10f, root_child0.getLayoutY(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_padding_center_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setPadding(YogaEdge.START, 10); root.setPadding(YogaEdge.END, 20); root.setPadding(YogaEdge.BOTTOM, 20); root.setAlignItems(YogaAlign.CENTER); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setWidth(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(40f, root_child0.getLayoutX(), 0.0f); assertEquals(35f, 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(50f, root_child0.getLayoutX(), 0.0f); assertEquals(35f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_child_with_padding_align_end() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setJustifyContent(YogaJustify.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setPadding(YogaEdge.ALL, 20); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_physical_and_relative_edge_defined() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setPadding(YogaEdge.LEFT, 20); root.setPadding(YogaEdge.END, 50); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(100f); root_child0.setHeight(50f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(130f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(50f, 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); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGPercentageTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGPercentageTest.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 YGPercentageTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_percentage_width_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(30f); root_child0.setHeightPercent(30f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(140f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percentage_position_left_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(400f); root.setHeight(400f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(45f); root_child0.setHeightPercent(55f); root_child0.setPositionPercent(YogaEdge.LEFT, 10f); root_child0.setPositionPercent(YogaEdge.TOP, 20f); 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(400f, root.getLayoutHeight(), 0.0f); assertEquals(40f, root_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0.getLayoutY(), 0.0f); assertEquals(180f, root_child0.getLayoutWidth(), 0.0f); assertEquals(220f, 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(400f, root.getLayoutWidth(), 0.0f); assertEquals(400f, root.getLayoutHeight(), 0.0f); assertEquals(260f, root_child0.getLayoutX(), 0.0f); assertEquals(80f, root_child0.getLayoutY(), 0.0f); assertEquals(180f, root_child0.getLayoutWidth(), 0.0f); assertEquals(220f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percentage_position_bottom_right() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(500f); root.setHeight(500f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(55f); root_child0.setHeightPercent(15f); root_child0.setPositionPercent(YogaEdge.BOTTOM, 10f); root_child0.setPositionPercent(YogaEdge.RIGHT, 20f); 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(-100f, root_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0.getLayoutY(), 0.0f); assertEquals(275f, root_child0.getLayoutWidth(), 0.0f); assertEquals(75f, 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(500f, root.getLayoutWidth(), 0.0f); assertEquals(500f, root.getLayoutHeight(), 0.0f); assertEquals(125f, root_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0.getLayoutY(), 0.0f); assertEquals(275f, root_child0.getLayoutWidth(), 0.0f); assertEquals(75f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root_child1.setFlexBasisPercent(25f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(125f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(125f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(75f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(125f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(75f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_cross() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root_child1.setFlexBasisPercent(25f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(125f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(125f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(75f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(125f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(125f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(75f, root_child1.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_percentage_flex_basis_cross_min_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setMinHeightPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(2f); root_child1.setMinHeightPercent(10f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(120f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(80f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(120f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(80f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_main_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(10f); root_child0.setMaxHeightPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(10f); root_child1.setMaxHeightPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(52f, root_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0.getLayoutHeight(), 0.0f); assertEquals(52f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(148f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(148f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(52f, root_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(148f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_cross_max_height() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(10f); root_child0.setMaxHeightPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(10f); root_child1.setMaxHeightPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(120f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(120f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(120f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_main_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(15f); root_child0.setMaxWidthPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(10f); root_child1.setMaxWidthPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(40f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_cross_max_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(10f); root_child0.setMaxWidthPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(15f); root_child1.setMaxWidthPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(120f, 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(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(160f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_main_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(15f); root_child0.setMinWidthPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(10f); root_child1.setMinWidthPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(120f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(120f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(80f, root_child1.getLayoutWidth(), 0.0f); assertEquals(200f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_flex_basis_cross_min_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(10f); root_child0.setMinWidthPercent(60f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(15f); root_child1.setMinWidthPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(50f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(150f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_multiple_nested_with_padding_margin_and_percentage_values() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(200f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setFlexBasisPercent(10f); root_child0.setMinWidthPercent(60f); root_child0.setMargin(YogaEdge.ALL, 5f); root_child0.setPadding(YogaEdge.ALL, 3); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(50f); root_child0_child0.setMargin(YogaEdge.ALL, 5f); root_child0_child0.setPaddingPercent(YogaEdge.ALL, 3); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setWidthPercent(45f); root_child0_child0_child0.setMarginPercent(YogaEdge.ALL, 5f); root_child0_child0_child0.setPadding(YogaEdge.ALL, 3); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(4f); root_child1.setFlexBasisPercent(15f); root_child1.setMinWidthPercent(20f); root.addChildAt(root_child1, 1); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(5f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(190f, root_child0.getLayoutWidth(), 0.0f); assertEquals(48f, root_child0.getLayoutHeight(), 0.0f); assertEquals(8f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(8f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(92f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(36f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(6f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(58f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(142f, root_child1.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(5f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(190f, root_child0.getLayoutWidth(), 0.0f); assertEquals(48f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(8f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(92f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(25f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(46f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(36f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(6f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(58f, root_child1.getLayoutY(), 0.0f); assertEquals(200f, root_child1.getLayoutWidth(), 0.0f); assertEquals(142f, root_child1.getLayoutHeight(), 0.0f); } @Test public void test_percentage_margin_should_calculate_based_only_on_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setMarginPercent(YogaEdge.ALL, 10f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0.getLayoutY(), 0.0f); assertEquals(160f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(150f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_percentage_padding_should_calculate_based_only_on_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setFlexGrow(1f); root_child0.setPaddingPercent(YogaEdge.ALL, 10); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(10f); root_child0_child0.setHeight(10f); root_child0.addChildAt(root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_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(200f, 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(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(170f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_percentage_absolute_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(200f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setPositionPercent(YogaEdge.TOP, 10f); root_child0.setPositionPercent(YogaEdge.LEFT, 30f); 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, 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(200f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutX(), 0.0f); assertEquals(10f, root_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percentage_width_height_undefined_parent_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeightPercent(50f); 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(0f, root.getLayoutWidth(), 0.0f); assertEquals(0f, 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(0f, root.getLayoutWidth(), 0.0f); assertEquals(0f, 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); } @Test public void test_percent_within_flex_grow() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(350f); root.setHeight(100f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidthPercent(100f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setWidth(100f); 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(350f, 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(100f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(150f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(150f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(250f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, 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(350f, root.getLayoutWidth(), 0.0f); assertEquals(100f, root.getLayoutHeight(), 0.0f); assertEquals(250f, 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(100f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(150f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(150f, 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(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_percentage_container_in_wrapping_container() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setAlignItems(YogaAlign.CENTER); root.setWidth(200f); root.setHeight(200f); root.setJustifyContent(YogaJustify.CENTER); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0_child0.setJustifyContent(YogaJustify.CENTER); root_child0_child0.setWidthPercent(100f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setHeight(50f); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidth(50f); root_child0_child0_child1.setHeight(50f); root_child0_child0.addChildAt(root_child0_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutX(), 0.0f); assertEquals(75f, root_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_percent_absolute_position() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(50f); root_child0.setWidthPercent(100f); root_child0.setPositionPercent(YogaEdge.LEFT, 50f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidthPercent(100f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setWidthPercent(100f); 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(60f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(60f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-60f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(60f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f); } @Test public void test_percent_of_minmax_main() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMinWidth(60f); root.setMaxWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_percent_of_min_main() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMinWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_percent_of_min_main_multiple() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMinWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidthPercent(50f); root_child1.setHeight(20f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setWidthPercent(50f); root_child2.setHeight(20f); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(30f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(60f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(-30f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_percent_of_max_main() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setFlexDirection(YogaFlexDirection.ROW); root.setMaxWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percent_of_minmax_cross_stretched() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(60f); root.setMaxWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percent_absolute_of_minmax_cross_stretched() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(60f); root.setMaxWidth(60f); root.setHeight(50f); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percent_of_minmax_cross_unstretched() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(60f); root.setMaxWidth(60f); root.setHeight(50f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test @Ignore public void test_percent_of_min_cross_unstretched() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMinWidth(60f); root.setHeight(50f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(60f, 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(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(60f, root.getLayoutWidth(), 0.0f); assertEquals(50f, root.getLayoutHeight(), 0.0f); assertEquals(30f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_percent_of_max_cross_unstretched() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setMaxWidth(60f); root.setHeight(50f); root.setAlignItems(YogaAlign.FLEX_START); final YogaNode root_child0 = createNode(config); root_child0.setWidthPercent(50f); root_child0.setHeight(20f); 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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, 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(0f, 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(0f, root_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGRoundingTest.java ================================================ /* * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGRoundingTest.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 YGRoundingTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_rounding_flex_basis_flex_grow_row_width_of_100() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(100f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexGrow(1f); 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(33f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(33f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(34f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(67f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(33f, 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(67f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(33f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(33f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(34f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(33f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_flex_basis_flex_grow_row_prime_number_width() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(113f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); 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.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexGrow(1f); root.addChildAt(root_child2, 2); final YogaNode root_child3 = createNode(config); root_child3.setFlexGrow(1f); root.addChildAt(root_child3, 3); final YogaNode root_child4 = createNode(config); root_child4.setFlexGrow(1f); root.addChildAt(root_child4, 4); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutY(), 0.0f); assertEquals(113f, 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(23f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(23f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(22f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(45f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(23f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(68f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(22f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(90f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.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(113f, 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(23f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(68f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(22f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(45f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(23f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(23f, root_child3.getLayoutX(), 0.0f); assertEquals(0f, root_child3.getLayoutY(), 0.0f); assertEquals(22f, root_child3.getLayoutWidth(), 0.0f); assertEquals(100f, root_child3.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutX(), 0.0f); assertEquals(0f, root_child4.getLayoutY(), 0.0f); assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); } @Test public void test_rounding_flex_basis_flex_shrink_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(101f); root.setHeight(100f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setFlexBasis(100f); root_child0.setFlexShrink(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setFlexBasis(25f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setFlexBasis(25f); 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(101f, 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(51f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(51f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(76f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, 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(101f, 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(51f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_flex_basis_overrides_main_size() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(113f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); 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(113f, 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(64f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, 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(113f, 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(64f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_total_fractial() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(113.4f); root.setWidth(87.4f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20.3f); root_child0.setFlexGrow(0.7f); root_child0.setFlexBasis(50.3f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1.6f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10.7f); root_child2.setFlexGrow(1.1f); 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(87f, root.getLayoutWidth(), 0.0f); assertEquals(113f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(87f, root_child0.getLayoutWidth(), 0.0f); assertEquals(59f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(59f, root_child1.getLayoutY(), 0.0f); assertEquals(87f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, 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(87f, root.getLayoutWidth(), 0.0f); assertEquals(113f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(87f, root_child0.getLayoutWidth(), 0.0f); assertEquals(59f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(59f, root_child1.getLayoutY(), 0.0f); assertEquals(87f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_total_fractial_nested() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(113.4f); root.setWidth(87.4f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20.3f); root_child0.setFlexGrow(0.7f); root_child0.setFlexBasis(50.3f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPosition(YogaEdge.BOTTOM, 13.3f); root_child0_child0.setHeight(9.9f); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexBasis(0.3f); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setPosition(YogaEdge.TOP, 13.3f); root_child0_child1.setHeight(1.1f); root_child0_child1.setFlexGrow(4f); root_child0_child1.setFlexBasis(0.3f); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1.6f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10.7f); root_child2.setFlexGrow(1.1f); 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(87f, root.getLayoutWidth(), 0.0f); assertEquals(113f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(87f, root_child0.getLayoutWidth(), 0.0f); assertEquals(59f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-13f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(87f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(12f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(25f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(87f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(47f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(59f, root_child1.getLayoutY(), 0.0f); assertEquals(87f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, 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(87f, root.getLayoutWidth(), 0.0f); assertEquals(113f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(87f, root_child0.getLayoutWidth(), 0.0f); assertEquals(59f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(-13f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(87f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(12f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f); assertEquals(25f, root_child0_child1.getLayoutY(), 0.0f); assertEquals(87f, root_child0_child1.getLayoutWidth(), 0.0f); assertEquals(47f, root_child0_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(59f, root_child1.getLayoutY(), 0.0f); assertEquals(87f, root_child1.getLayoutWidth(), 0.0f); assertEquals(30f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_fractial_input_1() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(113.4f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); 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(113f, 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(64f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, 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(113f, 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(64f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_fractial_input_2() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(113.6f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); 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(114f, 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(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(65f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(24f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(114f, 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(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(65f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(24f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_fractial_input_3() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setPosition(YogaEdge.TOP, 0.3f); root.setHeight(113.4f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); 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(114f, 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(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(24f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, 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(114f, 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(65f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(24f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_fractial_input_4() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setPosition(YogaEdge.TOP, 0.7f); root.setHeight(113.4f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(20f); root_child0.setFlexGrow(1f); root_child0.setFlexBasis(50f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); root.addChildAt(root_child2, 2); root.setDirection(YogaDirection.LTR); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(1f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(113f, 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(64f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); root.setDirection(YogaDirection.RTL); root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(1f, root.getLayoutY(), 0.0f); assertEquals(100f, root.getLayoutWidth(), 0.0f); assertEquals(113f, 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(64f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(64f, root_child1.getLayoutY(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(89f, root_child2.getLayoutY(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_inner_node_controversy_horizontal() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(320f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setHeight(10f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeight(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setHeight(10f); root_child1_child0.setFlexGrow(1f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setHeight(10f); root_child2.setFlexGrow(1f); 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(107f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(107f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(106f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(106f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(213f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(107f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, 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(320f, root.getLayoutWidth(), 0.0f); assertEquals(10f, root.getLayoutHeight(), 0.0f); assertEquals(213f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(107f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(107f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(106f, root_child1.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(106f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(107f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_inner_node_controversy_vertical() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(320f); final YogaNode root_child0 = createNode(config); root_child0.setWidth(10f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setWidth(10f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidth(10f); root_child1_child0.setFlexGrow(1f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child2 = createNode(config); root_child2.setWidth(10f); root_child2.setFlexGrow(1f); 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(10f, root.getLayoutWidth(), 0.0f); assertEquals(320f, 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(107f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(107f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(213f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(107f, 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(10f, root.getLayoutWidth(), 0.0f); assertEquals(320f, 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(107f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1.getLayoutX(), 0.0f); assertEquals(107f, root_child1.getLayoutY(), 0.0f); assertEquals(10f, root_child1.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(213f, root_child2.getLayoutY(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(107f, root_child2.getLayoutHeight(), 0.0f); } @Test public void test_rounding_inner_node_controversy_combined() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setWidth(640f); root.setHeight(320f); root.setFlexDirection(YogaFlexDirection.ROW); final YogaNode root_child0 = createNode(config); root_child0.setHeightPercent(100f); root_child0.setFlexGrow(1f); root.addChildAt(root_child0, 0); final YogaNode root_child1 = createNode(config); root_child1.setHeightPercent(100f); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); final YogaNode root_child1_child0 = createNode(config); root_child1_child0.setWidthPercent(100f); root_child1_child0.setFlexGrow(1f); root_child1.addChildAt(root_child1_child0, 0); final YogaNode root_child1_child1 = createNode(config); root_child1_child1.setWidthPercent(100f); root_child1_child1.setFlexGrow(1f); root_child1.addChildAt(root_child1_child1, 1); final YogaNode root_child1_child1_child0 = createNode(config); root_child1_child1_child0.setFlexGrow(1f); root_child1_child1_child0.setWidthPercent(100f); root_child1_child1.addChildAt(root_child1_child1_child0, 0); final YogaNode root_child1_child2 = createNode(config); root_child1_child2.setWidthPercent(100f); root_child1_child2.setFlexGrow(1f); root_child1.addChildAt(root_child1_child2, 2); final YogaNode root_child2 = createNode(config); root_child2.setHeightPercent(100f); root_child2.setFlexGrow(1f); 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(640f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(213f, root_child0.getLayoutWidth(), 0.0f); assertEquals(320f, root_child0.getLayoutHeight(), 0.0f); assertEquals(213f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(214f, root_child1.getLayoutWidth(), 0.0f); assertEquals(320f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(107f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(107f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1_child0.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child1_child0.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(213f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(107f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(427f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(213f, root_child2.getLayoutWidth(), 0.0f); assertEquals(320f, 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(640f, root.getLayoutWidth(), 0.0f); assertEquals(320f, root.getLayoutHeight(), 0.0f); assertEquals(427f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(213f, root_child0.getLayoutWidth(), 0.0f); assertEquals(320f, root_child0.getLayoutHeight(), 0.0f); assertEquals(213f, root_child1.getLayoutX(), 0.0f); assertEquals(0f, root_child1.getLayoutY(), 0.0f); assertEquals(214f, root_child1.getLayoutWidth(), 0.0f); assertEquals(320f, root_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child0.getLayoutWidth(), 0.0f); assertEquals(107f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f); assertEquals(107f, root_child1_child1.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child1.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1_child1.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child1_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child1_child1_child0.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child1_child0.getLayoutWidth(), 0.0f); assertEquals(106f, root_child1_child1_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f); assertEquals(213f, root_child1_child2.getLayoutY(), 0.0f); assertEquals(214f, root_child1_child2.getLayoutWidth(), 0.0f); assertEquals(107f, root_child1_child2.getLayoutHeight(), 0.0f); assertEquals(0f, root_child2.getLayoutX(), 0.0f); assertEquals(0f, root_child2.getLayoutY(), 0.0f); assertEquals(213f, root_child2.getLayoutWidth(), 0.0f); assertEquals(320f, root_child2.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGSizeOverflowTest.java ================================================ /* * 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<<1e5af7129e23b9dd1228bdaef498c19c>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGSizeOverflowTest.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 YGSizeOverflowTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_nested_overflowing_child() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0.addChildAt(root_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(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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_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(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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(-100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_nested_overflowing_child_in_constraint_parent() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); root.setHeight(100f); root.setWidth(100f); final YogaNode root_child0 = createNode(config); root_child0.setHeight(100f); root_child0.setWidth(100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0.addChildAt(root_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(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_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_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(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(-100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_parent_wrap_child_size_overflowing_parent() { 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.setWidth(100f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setWidth(100f); root_child0_child0.setHeight(200f); root_child0.addChildAt(root_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(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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_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(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(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); } private YogaNode createNode(YogaConfig config) { return mNodeFactory.create(config); } } ================================================ FILE: java/tests/generated/com/facebook/yoga/YGStaticPositionTest.java ================================================ /* * 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<<2d3b1fc3c172c1d6fe052278ae6daff7>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGStaticPositionTest.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 YGStaticPositionTest { @Parameterized.Parameters(name = "{0}") public static Iterable nodeFactories() { return TestParametrization.nodeFactories(); } @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; @Test public void test_static_position_insets_have_no_effect_left_top() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setPositionType(YogaPositionType.STATIC); root_child0.setPosition(YogaEdge.TOP, 50f); root_child0.setPosition(YogaEdge.LEFT, 50f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_insets_have_no_effect_right_bottom() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(100f); root_child0.setHeight(100f); root_child0.setPositionType(YogaPositionType.STATIC); root_child0.setPosition(YogaEdge.BOTTOM, 50f); root_child0.setPosition(YogaEdge.RIGHT, 50f); 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setMargin(YogaEdge.LEFT, 100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.LEFT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.LEFT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_row_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.LEFT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_row() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setFlexDirection(YogaFlexDirection.ROW); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor_column_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, 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(-50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_column_reverse() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, 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(-50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_insets_relative_to_positioned_ancestor_deep() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setMargin(YogaEdge.LEFT, 100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(100f); root_child0_child0_child0.setWidth(100f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 100f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setHeight(100f); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 100f); root_child0_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0_child0.setHeight(100f); root_child0_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 100f); root_child0_child0_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0_child0_child0.setWidth(50f); root_child0_child0_child0_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0_child0_child0_child0.setPosition(YogaEdge.TOP, 50f); root_child0_child0_child0_child0_child0_child0.setPosition(YogaEdge.LEFT, 50f); root_child0_child0_child0_child0_child0.addChildAt(root_child0_child0_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-350f, root_child0_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_width_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_width_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_width_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_height_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_height_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_height_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_left_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_left_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_left_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_right_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.RIGHT, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_right_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.RIGHT, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_right_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.RIGHT, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_top_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.TOP, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_top_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.TOP, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_top_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.TOP, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_bottom_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.BOTTOM, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_bottom_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.BOTTOM, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(-50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_bottom_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionPercent(YogaEdge.BOTTOM, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_margin_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setMarginPercent(YogaEdge.ALL, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_margin_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setMarginPercent(YogaEdge.ALL, 50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_margin_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setMarginPercent(YogaEdge.ALL, 50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_padding_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPaddingPercent(YogaEdge.ALL, 50); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_padding_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPaddingPercent(YogaEdge.ALL, 50); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_padding_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPaddingPercent(YogaEdge.ALL, 50); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_border_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_border_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_border_percentage() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(200f); root_child0.setHeight(200f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidth(50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, 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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(200f, root.getLayoutWidth(), 0.0f); assertEquals(200f, root.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_containing_block_padding_box() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(50f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(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(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(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(-100f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_containing_block_padding_box() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(50f); root_child0_child0.addChildAt(root_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(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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(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(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_containing_block_padding_box() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(50f); root_child0_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.addChildAt(root_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(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(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(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(50f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_absolute_child_containing_block_content_box() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(50f); root_child0_child0.setWidthPercent(50f); root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.addChildAt(root_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(400f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_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(400f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_relative_child_containing_block_content_box() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(50f); root_child0_child0.setWidthPercent(50f); root_child0.addChildAt(root_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(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(50f, root_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(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(50f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_child_containing_block_content_box() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(50f); root_child0_child0.setWidthPercent(50f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_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(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(50f, root_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(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(50f, root_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_containing_block_padding_and_border() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.TOP, 8); root_child0.setPadding(YogaEdge.RIGHT, 1); root_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0.setPadding(YogaEdge.LEFT, 9); root_child0.setBorder(YogaEdge.TOP, 5f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 4f); root_child0.setBorder(YogaEdge.LEFT, 2f); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(61f); root_child0_child0_child0.setWidthPercent(41f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_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(400f, root_child0.getLayoutHeight(), 0.0f); assertEquals(11f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(13f, 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(160f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(239f, root_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(400f, root_child0.getLayoutHeight(), 0.0f); assertEquals(292f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(13f, 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(160f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(239f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(500f); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(63f); root_child0_child0_child0.setWidthPercent(41f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 12f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(1f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-2f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_no_position_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(500f); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(63f); root_child0_child0_child0.setWidthPercent(41f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-15f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_zero_for_inset_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(500f); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(63f); root_child0_child0_child0.setWidthPercent(41f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPositionPercent(YogaEdge.LEFT, 0f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-1f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-265f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_start_inset_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(500f); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(63f); root_child0_child0_child0.setWidthPercent(41f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.START, 12f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(11f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-2f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_end_inset_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setWidth(500f); root_child0.setHeight(500f); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(200f); root_child0_child0.setWidth(200f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeightPercent(63f); root_child0_child0_child0.setWidthPercent(41f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setPosition(YogaEdge.END, 4f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(270f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_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(513f, root.getLayoutWidth(), 0.0f); assertEquals(506f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(500f, root_child0.getLayoutWidth(), 0.0f); assertEquals(500f, root_child0.getLayoutHeight(), 0.0f); assertEquals(279f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-261f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(200f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(306f, root_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_row_reverse_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE); 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.setHeightPercent(12f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-128f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(133f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(23f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(133f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(23f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_column_reverse_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); 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(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(-82f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-15f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(-82f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_justify_flex_start_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); 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(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(111f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_justify_flex_start_position_set_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); 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(21f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 30f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(106f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(106f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_no_definite_size_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); 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.setPositionPercent(YogaEdge.LEFT, 23f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(133f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(133f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_both_insets_set_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); 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.setPositionPercent(YogaEdge.LEFT, 23f); root_child0_child0_child0.setPosition(YogaEdge.RIGHT, 13f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(9f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, 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(69f, root.getLayoutWidth(), 0.0f); assertEquals(79f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(56f, root_child0.getLayoutWidth(), 0.0f); assertEquals(73f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(22f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-3f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_justify_center_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0_child0.setJustifyContent(YogaJustify.CENTER); 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(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(85f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(111f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(85f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_justify_flex_end_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0_child0.setJustifyContent(YogaJustify.FLEX_END); 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(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(111f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_align_flex_start_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); 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_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0_child0.setWidthPercent(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(111f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_align_center_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0_child0.setAlignItems(YogaAlign.CENTER); 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(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(65f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(39f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(65f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(39f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(75f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_align_flex_end_amalgamation() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setPositionType(YogaPositionType.ABSOLUTE); final YogaNode root_child0 = createNode(config); root_child0.setMargin(YogaEdge.TOP, 5f); root_child0.setMargin(YogaEdge.RIGHT, 9f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 4f); root_child0.setBorder(YogaEdge.TOP, 6f); root_child0.setBorder(YogaEdge.RIGHT, 7f); root_child0.setBorder(YogaEdge.BOTTOM, 8f); root_child0.setBorder(YogaEdge.LEFT, 5f); root_child0.setPadding(YogaEdge.TOP, 9); root_child0.setPadding(YogaEdge.RIGHT, 11); root_child0.setPadding(YogaEdge.BOTTOM, 13); root_child0.setPadding(YogaEdge.LEFT, 2); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0_child0.setMargin(YogaEdge.TOP, 6f); root_child0_child0.setMargin(YogaEdge.RIGHT, 3f); root_child0_child0.setMargin(YogaEdge.BOTTOM, 9f); root_child0_child0.setMargin(YogaEdge.LEFT, 8f); root_child0_child0.setBorder(YogaEdge.TOP, 10f); root_child0_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0_child0.setBorder(YogaEdge.LEFT, 8f); root_child0_child0.setPadding(YogaEdge.TOP, 7); root_child0_child0.setPadding(YogaEdge.RIGHT, 9); root_child0_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0_child0.setPadding(YogaEdge.LEFT, 1); root_child0_child0.setAlignItems(YogaAlign.FLEX_END); 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(21f); root_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child0_child0_child0 = createNode(config); root_child0_child0_child0_child0.setWidth(100f); root_child0_child0_child0_child0.setHeight(50f); root_child0_child0_child0_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child0_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child0_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child0_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child0_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child0_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child0_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child0_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child0_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child0_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child0_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0); final YogaNode root_child0_child0_child1 = createNode(config); root_child0_child0_child1.setWidthPercent(10f); root_child0_child0_child1.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child1, 1); final YogaNode root_child0_child0_child1_child0 = createNode(config); root_child0_child0_child1_child0.setWidth(100f); root_child0_child0_child1_child0.setHeight(50f); root_child0_child0_child1_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child1_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child1_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child1_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child1_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child1_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child1_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child1_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child1_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child1_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child1_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child1.addChildAt(root_child0_child0_child1_child0, 0); final YogaNode root_child0_child0_child2 = createNode(config); root_child0_child0_child2.setWidthPercent(10f); root_child0_child0_child2.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2.setPadding(YogaEdge.LEFT, 5); root_child0_child0.addChildAt(root_child0_child0_child2, 2); final YogaNode root_child0_child0_child2_child0 = createNode(config); root_child0_child0_child2_child0.setWidth(100f); root_child0_child0_child2_child0.setHeight(50f); root_child0_child0_child2_child0.setMargin(YogaEdge.TOP, 12f); root_child0_child0_child2_child0.setMargin(YogaEdge.RIGHT, 4f); root_child0_child0_child2_child0.setMargin(YogaEdge.BOTTOM, 7f); root_child0_child0_child2_child0.setMargin(YogaEdge.LEFT, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.TOP, 1f); root_child0_child0_child2_child0.setBorder(YogaEdge.RIGHT, 5f); root_child0_child0_child2_child0.setBorder(YogaEdge.BOTTOM, 9f); root_child0_child0_child2_child0.setBorder(YogaEdge.LEFT, 2f); root_child0_child0_child2_child0.setPadding(YogaEdge.TOP, 3); root_child0_child0_child2_child0.setPadding(YogaEdge.RIGHT, 8); root_child0_child0_child2_child0.setPadding(YogaEdge.BOTTOM, 10); root_child0_child0_child2_child0.setPadding(YogaEdge.LEFT, 5); root_child0_child0_child2.addChildAt(root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(111f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(131f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_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(215f, root.getLayoutWidth(), 0.0f); assertEquals(301f, root.getLayoutHeight(), 0.0f); assertEquals(4f, root_child0.getLayoutX(), 0.0f); assertEquals(5f, root_child0.getLayoutY(), 0.0f); assertEquals(202f, root_child0.getLayoutWidth(), 0.0f); assertEquals(295f, root_child0.getLayoutHeight(), 0.0f); assertEquals(15f, root_child0_child0.getLayoutX(), 0.0f); assertEquals(21f, root_child0_child0.getLayoutY(), 0.0f); assertEquals(166f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(244f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(-77f, root_child0_child0_child0_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child0_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child1.getLayoutX(), 0.0f); assertEquals(29f, root_child0_child0_child1.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child1.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child1.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child1_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child1_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child1_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child1_child0.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0_child0_child2.getLayoutX(), 0.0f); assertEquals(140f, root_child0_child0_child2.getLayoutY(), 0.0f); assertEquals(20f, root_child0_child0_child2.getLayoutWidth(), 0.0f); assertEquals(92f, root_child0_child0_child2.getLayoutHeight(), 0.0f); assertEquals(-97f, root_child0_child0_child2_child0.getLayoutX(), 0.0f); assertEquals(16f, root_child0_child0_child2_child0.getLayoutY(), 0.0f); assertEquals(100f, root_child0_child0_child2_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0_child0_child2_child0.getLayoutHeight(), 0.0f); } @Test public void test_static_position_static_root() { YogaConfig config = YogaConfigFactory.create(); final YogaNode root = createNode(config); root.setHeight(200f); root.setWidth(100f); root.setPositionType(YogaPositionType.STATIC); root.setPadding(YogaEdge.TOP, 1); root.setPadding(YogaEdge.RIGHT, 11); root.setPadding(YogaEdge.BOTTOM, 4); root.setPadding(YogaEdge.LEFT, 6); final YogaNode root_child0 = createNode(config); root_child0.setHeightPercent(50f); root_child0.setWidthPercent(50f); root_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0.setBorder(YogaEdge.TOP, 3f); root_child0.setBorder(YogaEdge.RIGHT, 2f); root_child0.setBorder(YogaEdge.BOTTOM, 1f); root_child0.setBorder(YogaEdge.LEFT, 4f); root_child0.setPadding(YogaEdge.TOP, 7); root_child0.setPadding(YogaEdge.RIGHT, 5); root_child0.setPadding(YogaEdge.BOTTOM, 4); root_child0.setPadding(YogaEdge.LEFT, 3); root_child0.setMargin(YogaEdge.TOP, 11f); root_child0.setMargin(YogaEdge.RIGHT, 15f); root_child0.setMargin(YogaEdge.BOTTOM, 1f); root_child0.setMargin(YogaEdge.LEFT, 12f); 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(18f, root_child0.getLayoutX(), 0.0f); assertEquals(12f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, 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(200f, root.getLayoutHeight(), 0.0f); assertEquals(24f, root_child0.getLayoutX(), 0.0f); assertEquals(12f, root_child0.getLayoutY(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); 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.setWidth(400f); root_child0.setHeight(400f); root_child0.setPadding(YogaEdge.ALL, 100); root.addChildAt(root_child0, 0); final YogaNode root_child0_child0 = createNode(config); root_child0_child0.setHeight(100f); root_child0_child0.setWidth(100f); root_child0_child0.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child0, 0); final YogaNode root_child0_child0_child0 = createNode(config); root_child0_child0_child0.setHeight(50f); root_child0_child0_child0.setWidthPercent(10f); root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child0.addChildAt(root_child0_child0_child0, 0); final YogaNode root_child0_child1 = createNode(config); root_child0_child1.setHeight(100f); root_child0_child1.setWidth(100f); root_child0_child1.setPositionType(YogaPositionType.STATIC); root_child0.addChildAt(root_child0_child1, 1); final YogaNode root_child0_child1_child0 = createNode(config); root_child0_child1_child0.setHeight(50f); root_child0_child1_child0.setWidthPercent(50f); root_child0_child1_child0.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child1.addChildAt(root_child0_child1_child0, 0); final YogaNode root_child0_child1_child1 = createNode(config); root_child0_child1_child1.setHeight(50f); root_child0_child1_child1.setWidthPercent(50f); root_child0_child1_child1.setPositionType(YogaPositionType.ABSOLUTE); root_child0_child1.addChildAt(root_child0_child1_child1, 1); final YogaNode root_child0_child2 = createNode(config); root_child0_child2.setHeight(50f); root_child0_child2.setWidth(25f); root_child0_child2.setPositionType(YogaPositionType.ABSOLUTE); 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); } } ================================================ FILE: java/yogajni.version ================================================ /* * 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. */ { global: JNI_OnLoad; local: *; }; ================================================ FILE: javascript/.gitignore ================================================ /.emsdk /binaries /build /dist ================================================ FILE: javascript/CMakeLists.txt ================================================ # 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. cmake_minimum_required(VERSION 3.13...3.26) set(CMAKE_VERBOSE_MAKEFILE on) project(yoga C CXX) file(GLOB YOGA_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../yoga/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../yoga/**/*.cpp) set(BRIDGE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/wasm_bridge.c) include_directories(..) set(CMAKE_CXX_STANDARD 20) set(COMPILE_OPTIONS -flto -fno-exceptions -fno-rtti -Wno-ignored-attributes -g0 -Os "SHELL:-s STRICT=1") add_compile_options(${COMPILE_OPTIONS}) add_link_options( ${COMPILE_OPTIONS} "SHELL:--closure 1" "SHELL:--no-entry" "SHELL:-s ALLOW_MEMORY_GROWTH=1" "SHELL:-s ASSERTIONS=0" "SHELL:-s DYNAMIC_EXECUTION=0" "SHELL:-s EXPORT_NAME='loadYoga'" "SHELL:-s FETCH_SUPPORT_INDEXEDDB=0" "SHELL:-s FILESYSTEM=0" "SHELL:-s MALLOC='emmalloc'" "SHELL:-s MODULARIZE=1" "SHELL:-s EXPORT_ES6=1" "SHELL:-s WASM=1" "SHELL:-s TEXTDECODER=2" "SHELL:-s SUPPORT_BIG_ENDIAN=1" # SINGLE_FILE=1 combined with ENVIRONMENT='web' creates code that works on # both bundlders and Node. "SHELL:-s SINGLE_FILE=1" "SHELL:-s ENVIRONMENT='web'" "SHELL:-s EXPORTED_RUNTIME_METHODS=['HEAPF32','HEAP32']" "SHELL:-Wl,--export-dynamic") add_library(yogaObjLib OBJECT ${YOGA_SOURCES} ${BRIDGE_SOURCES}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/binaries) add_executable(yoga-wasm-base64-esm $) ================================================ FILE: javascript/README.md ================================================ # yoga-layout This package provides prebuilt WebAssembly bindings for the Yoga layout engine. See more at https://yogalayout.dev ## Usage ```ts import {Yoga, Align} from 'yoga-layout'; const node = Yoga.Node.create(); node.setAlignContent(Align.Center); ``` ## Requirements `yoga-layout` requires a toolchain that supports ES Modules and top-level await. If top-level-await is not supported, use the `yoga-layout/load` entry point instead. This requires to load yoga manually: ```ts import {loadYoga, Align} from 'yoga-layout/load'; const node = (await loadYoga()).Node.create(); node.setAlignContent(Align.Center); ``` ================================================ FILE: javascript/babel.config.cjs ================================================ /** * 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. * * @format */ module.exports = api => ({ presets: [ [ '@babel/preset-env', { targets: [ 'maintained node versions', '> 0.5%, last 2 versions, Firefox ESR, not dead', ], // Do not transform to another module system modules: false, }, ], [ '@babel/preset-typescript', { rewriteImportExtensions: api.env('dist'), }, ], ], }); ================================================ FILE: javascript/jest.config.js ================================================ /** * 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. * * @format */ export default { setupFiles: ['./jest.setup.js'], testRegex: '/tests/.*\\.test\\.ts$', extensionsToTreatAsEsm: ['.ts'], }; ================================================ FILE: javascript/jest.setup.js ================================================ /** * 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. * * @format */ Object.defineProperty(globalThis, 'YGBENCHMARK', { get: () => globalThis.test, }); ================================================ FILE: javascript/just.config.cjs ================================================ /** * 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. * * @format */ const { argv, cleanTask, logger, jestTask, option, series, spawn, task, tscTask, copyTask, } = require('just-scripts'); const {existsSync} = require('fs'); const {readFile, writeFile, rm} = require('fs/promises'); const {glob} = require('glob'); const path = require('path'); const which = require('which'); const node = process.execPath; option('fix'); task('clean', cleanTask({paths: ['.emsdk', 'binaries', 'build']})); task( 'build', series(installEmsdkTask(), emcmakeGenerateTask(), cmakeBuildTask()), ); task( 'test', series( 'build', jestTask({ config: path.join(__dirname, 'jest.config.js'), nodeArgs: ['--experimental-vm-modules'], }), ), ); task('benchmark', series('build', runBenchTask())); task('clang-format', clangFormatTask({fix: argv().fix})); task('prepack-package-json', async () => { const packageJsonPath = path.join(__dirname, 'package.json'); const packageJsonContents = await readFile(packageJsonPath); const packageJson = JSON.parse(packageJsonContents.toString('utf-8')); packageJson.main = packageJson.main.replace( /^.\/src\/(.*)\.ts/, './dist/src/$1.js', ); packageJson.types = packageJson.main.replace(/(.*)\.js/, '$1.d.ts'); recursiveReplace( packageJson.exports, /^.\/src\/(.*)\.ts/, './dist/src/$1.js', ); await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2)); }); task( 'prepack', series( 'build', copyTask({paths: ['binaries'], dest: 'dist/binaries'}), tscTask({ emitDeclarationOnly: true, rootDir: '.', declarationDir: 'dist', }), babelTransformTask({src: 'src', dst: 'dist/src'}), 'prepack-package-json', ), ); function recursiveReplace(obj, pattern, replacement) { for (const [key, value] of Object.entries(obj)) { if (typeof value === 'string') { obj[key] = value.replace(pattern, replacement); } else if (typeof value === 'object' && value != null) { recursiveReplace(value, pattern, replacement); } } } function babelTransformTask(opts) { return () => { const args = [ opts.src, '--source-maps', '--out-dir', opts.dst, '--extensions', '.js,.cjs,.mjs,.ts,.cts,.mts', ]; logger.info(`Transforming "${path.resolve(opts.src)}"`); return spawn(node, [require.resolve('@babel/cli/bin/babel'), ...args], { cwd: __dirname, env: { // Trigger distribution-specific Babel transforms NODE_ENV: 'dist', }, }); }; } function runBenchTask() { return () => { const files = glob.sync('./tests/Benchmarks/**/*'); const args = [ '--loader=babel-register-esm', './tests/bin/run-bench.ts', ...files, ]; logger.info(['node', ...args].join(' ')); return spawn(node, args, { stdio: 'inherit', }); }; } const emsdkVersion = '4.0.23'; const emsdkPath = path.join(__dirname, '.emsdk'); const emsdkBin = path.join( emsdkPath, process.platform === 'win32' ? 'emsdk.bat' : 'emsdk', ); const emcmakeBin = path.join( emsdkPath, 'upstream', 'emscripten', process.platform === 'win32' ? 'emcmake.bat' : 'emcmake', ); function installEmsdkTask() { return async () => { if (await isEmsdkReadyAndActivated()) { logger.verbose( `emsdk ${emsdkVersion} is already installed and activated`, ); return false; } logger.info(`installing emsdk ${emsdkVersion} to ${emsdkPath}`); await rm(emsdkPath, {recursive: true, force: true}); await spawn( 'git', ['clone', 'https://github.com/emscripten-core/emsdk.git', emsdkPath], {stdio: 'inherit'}, ); await spawnShell(emsdkBin, ['install', emsdkVersion], {stdio: 'inherit'}); await spawnShell(emsdkBin, ['activate', emsdkVersion], { stdio: logger.enableVerbose ? 'inherit' : 'ignore', }); }; } async function isEmsdkReadyAndActivated() { if (!existsSync(emcmakeBin)) { return false; } try { const emsdkReleases = JSON.parse( await readFile(path.join(emsdkPath, 'emscripten-releases-tags.json')), ).releases; const versionHash = emsdkReleases[emsdkVersion]; if (!versionHash) { return false; } const activatedVersion = await readFile( path.join(emsdkPath, 'upstream', '.emsdk_version'), ); return activatedVersion.toString().includes(versionHash); } catch { // Something is wrong. Pave and redo. return false; } } function emcmakeGenerateTask() { return () => { logger.verbose(`emcmake path: ${emcmakeBin}`); const args = [ 'cmake', '-S', '.', '-B', 'build', ...(process.platform === 'win32' ? [] : ['-G', 'Ninja']), ]; logger.info(['emcmake', ...args].join(' ')); return spawnShell(emcmakeBin, args, { stdio: logger.enableVerbose ? 'inherit' : 'ignore', }); }; } function cmakeBuildTask(opts) { return () => { const cmake = which.sync('cmake'); logger.verbose(`cmake path: ${cmake}`); const args = [ '--build', 'build', ...(opts?.targets ? ['--target', ...opts.targets] : []), ]; logger.info(['cmake', ...args].join(' ')); return spawnShell(cmake, args, {stdio: 'inherit'}); }; } function clangFormatTask(opts) { return () => { const args = [ ...(opts?.fix ? ['-i'] : ['--dry-run', '--Werror']), ...glob.sync('**/*.{h,hh,hpp,c,cpp,cc,m,mm}'), ]; logger.info(['clang-format', ...args].join(' ')); return spawnShell(node, [require.resolve('clang-format'), ...args], { stdio: 'inherit', }); }; } function spawnShell(cmd, args, opts) { // https://github.com/nodejs/node/issues/52554 return spawn(cmd, args, {...opts, shell: true}); } ================================================ FILE: javascript/package.json ================================================ { "name": "yoga-layout", "version": "0.0.0", "description": "An embeddable and performant flexbox layout engine with bindings for multiple languages", "license": "MIT", "author": "Meta Open Source", "homepage": "https://yogalayout.dev/", "repository": { "type": "git", "url": "git@github.com:facebook/yoga.git" }, "type": "module", "main": "./src/index.ts", "types": "./src/index.ts", "exports": { ".": "./src/index.ts", "./load": "./src/load.ts" }, "files": [ "dist/binaries/**", "dist/src/**", "src/**" ], "scripts": { "benchmark": "just benchmark --config just.config.cjs", "build": "just build --config just.config.cjs", "clang-format": "just clang-format --config just.config.cjs", "clang-format:fix": "just clang-format --fix --config just.config.cjs", "clean": "just clean --config just.config.cjs", "lint": "eslint .", "lint:fix": "eslint . --fix", "prepack": "just prepack --config just.config.cjs", "test": "just test --config just.config.cjs", "tsc": "tsc --noEmit" }, "devDependencies": { "@babel/cli": "^7.23.0", "@babel/core": "^7.23.0", "@babel/preset-env": "^7.23.0", "@babel/preset-typescript": "^7.23.0", "@types/jest": "^29.5.1", "@types/node": "^16.18.25", "@types/which": "^3.0.0", "@yogalayout/cmake-bin": "3.28.0-1", "babel-register-esm": "^1.2.5", "clang-format": "^1.8.0", "glob": "^10.4.2", "jest": "^29.3.1", "just-scripts": "^2.1.0", "ninja-binaries": "^1.11.1", "which": "^3.0.0" } } ================================================ FILE: javascript/src/generated/YGEnums.ts ================================================ /** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @generated by enums.py export enum Align { Auto = 0, FlexStart = 1, Center = 2, FlexEnd = 3, Stretch = 4, Baseline = 5, SpaceBetween = 6, SpaceAround = 7, SpaceEvenly = 8, Start = 9, End = 10, } export enum BoxSizing { BorderBox = 0, ContentBox = 1, } export enum Dimension { Width = 0, Height = 1, } export enum Direction { Inherit = 0, LTR = 1, RTL = 2, } export enum Display { Flex = 0, None = 1, Contents = 2, Grid = 3, } export enum Edge { Left = 0, Top = 1, Right = 2, Bottom = 3, Start = 4, End = 5, Horizontal = 6, Vertical = 7, All = 8, } export enum Errata { None = 0, StretchFlexBasis = 1, AbsolutePositionWithoutInsetsExcludesPadding = 2, AbsolutePercentAgainstInnerSize = 4, All = 2147483647, Classic = 2147483646, } export enum ExperimentalFeature { WebFlexBasis = 0, FixFlexBasisFitContent = 1, } export enum FlexDirection { Column = 0, ColumnReverse = 1, Row = 2, RowReverse = 3, } export enum GridTrackType { Auto = 0, Points = 1, Percent = 2, Fr = 3, Minmax = 4, } export enum Gutter { Column = 0, Row = 1, All = 2, } export enum Justify { Auto = 0, FlexStart = 1, Center = 2, FlexEnd = 3, SpaceBetween = 4, SpaceAround = 5, SpaceEvenly = 6, Stretch = 7, Start = 8, End = 9, } export enum LogLevel { Error = 0, Warn = 1, Info = 2, Debug = 3, Verbose = 4, Fatal = 5, } export enum MeasureMode { Undefined = 0, Exactly = 1, AtMost = 2, } export enum NodeType { Default = 0, Text = 1, } export enum Overflow { Visible = 0, Hidden = 1, Scroll = 2, } export enum PositionType { Static = 0, Relative = 1, Absolute = 2, } export enum Unit { Undefined = 0, Point = 1, Percent = 2, Auto = 3, MaxContent = 4, FitContent = 5, Stretch = 6, } export enum Wrap { NoWrap = 0, Wrap = 1, WrapReverse = 2, } const constants = { ALIGN_AUTO: Align.Auto, ALIGN_FLEX_START: Align.FlexStart, ALIGN_CENTER: Align.Center, ALIGN_FLEX_END: Align.FlexEnd, ALIGN_STRETCH: Align.Stretch, ALIGN_BASELINE: Align.Baseline, ALIGN_SPACE_BETWEEN: Align.SpaceBetween, ALIGN_SPACE_AROUND: Align.SpaceAround, ALIGN_SPACE_EVENLY: Align.SpaceEvenly, ALIGN_START: Align.Start, ALIGN_END: Align.End, BOX_SIZING_BORDER_BOX: BoxSizing.BorderBox, BOX_SIZING_CONTENT_BOX: BoxSizing.ContentBox, DIMENSION_WIDTH: Dimension.Width, DIMENSION_HEIGHT: Dimension.Height, DIRECTION_INHERIT: Direction.Inherit, DIRECTION_LTR: Direction.LTR, DIRECTION_RTL: Direction.RTL, DISPLAY_FLEX: Display.Flex, DISPLAY_NONE: Display.None, DISPLAY_CONTENTS: Display.Contents, DISPLAY_GRID: Display.Grid, EDGE_LEFT: Edge.Left, EDGE_TOP: Edge.Top, EDGE_RIGHT: Edge.Right, EDGE_BOTTOM: Edge.Bottom, EDGE_START: Edge.Start, EDGE_END: Edge.End, EDGE_HORIZONTAL: Edge.Horizontal, EDGE_VERTICAL: Edge.Vertical, EDGE_ALL: Edge.All, ERRATA_NONE: Errata.None, ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: Errata.AbsolutePositionWithoutInsetsExcludesPadding, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: Errata.AbsolutePercentAgainstInnerSize, ERRATA_ALL: Errata.All, ERRATA_CLASSIC: Errata.Classic, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis, EXPERIMENTAL_FEATURE_FIX_FLEX_BASIS_FIT_CONTENT: ExperimentalFeature.FixFlexBasisFitContent, FLEX_DIRECTION_COLUMN: FlexDirection.Column, FLEX_DIRECTION_COLUMN_REVERSE: FlexDirection.ColumnReverse, FLEX_DIRECTION_ROW: FlexDirection.Row, FLEX_DIRECTION_ROW_REVERSE: FlexDirection.RowReverse, GRID_TRACK_TYPE_AUTO: GridTrackType.Auto, GRID_TRACK_TYPE_POINTS: GridTrackType.Points, GRID_TRACK_TYPE_PERCENT: GridTrackType.Percent, GRID_TRACK_TYPE_FR: GridTrackType.Fr, GRID_TRACK_TYPE_MINMAX: GridTrackType.Minmax, GUTTER_COLUMN: Gutter.Column, GUTTER_ROW: Gutter.Row, GUTTER_ALL: Gutter.All, JUSTIFY_AUTO: Justify.Auto, JUSTIFY_FLEX_START: Justify.FlexStart, JUSTIFY_CENTER: Justify.Center, JUSTIFY_FLEX_END: Justify.FlexEnd, JUSTIFY_SPACE_BETWEEN: Justify.SpaceBetween, JUSTIFY_SPACE_AROUND: Justify.SpaceAround, JUSTIFY_SPACE_EVENLY: Justify.SpaceEvenly, JUSTIFY_STRETCH: Justify.Stretch, JUSTIFY_START: Justify.Start, JUSTIFY_END: Justify.End, LOG_LEVEL_ERROR: LogLevel.Error, LOG_LEVEL_WARN: LogLevel.Warn, LOG_LEVEL_INFO: LogLevel.Info, LOG_LEVEL_DEBUG: LogLevel.Debug, LOG_LEVEL_VERBOSE: LogLevel.Verbose, LOG_LEVEL_FATAL: LogLevel.Fatal, MEASURE_MODE_UNDEFINED: MeasureMode.Undefined, MEASURE_MODE_EXACTLY: MeasureMode.Exactly, MEASURE_MODE_AT_MOST: MeasureMode.AtMost, NODE_TYPE_DEFAULT: NodeType.Default, NODE_TYPE_TEXT: NodeType.Text, OVERFLOW_VISIBLE: Overflow.Visible, OVERFLOW_HIDDEN: Overflow.Hidden, OVERFLOW_SCROLL: Overflow.Scroll, POSITION_TYPE_STATIC: PositionType.Static, POSITION_TYPE_RELATIVE: PositionType.Relative, POSITION_TYPE_ABSOLUTE: PositionType.Absolute, UNIT_UNDEFINED: Unit.Undefined, UNIT_POINT: Unit.Point, UNIT_PERCENT: Unit.Percent, UNIT_AUTO: Unit.Auto, UNIT_MAX_CONTENT: Unit.MaxContent, UNIT_FIT_CONTENT: Unit.FitContent, UNIT_STRETCH: Unit.Stretch, WRAP_NO_WRAP: Wrap.NoWrap, WRAP_WRAP: Wrap.Wrap, WRAP_WRAP_REVERSE: Wrap.WrapReverse, } export default constants ================================================ FILE: javascript/src/index.ts ================================================ /** * 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. * * @format */ // @ts-ignore untyped from Emscripten import loadYoga from '../binaries/yoga-wasm-base64-esm.js'; import wrapAssembly from './wrapAssembly.ts'; export type { Config, DirtiedFunction, MeasureFunction, Node, } from './wrapAssembly.ts'; const Yoga = wrapAssembly(await loadYoga()); export default Yoga; export * from './generated/YGEnums.ts'; ================================================ FILE: javascript/src/load.ts ================================================ /** * 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. * * @format */ // @ts-ignore untyped from Emscripten import loadYogaImpl from '../binaries/yoga-wasm-base64-esm.js'; import wrapAssembly from './wrapAssembly.ts'; export type { Config, DirtiedFunction, MeasureFunction, Node, Yoga, } from './wrapAssembly.ts'; export async function loadYoga() { return wrapAssembly(await loadYogaImpl()); } export * from './generated/YGEnums.ts'; ================================================ FILE: javascript/src/wasm_bridge.c ================================================ /* * 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. */ #include #include // Static buffer for returning YGValue structs to JS. // JS reads buf[0] as float (value) and buf[1] as int (unit) via HEAPF32/HEAP32. // Safe because WASM is single-threaded. static float ygvalue_buf[2]; static void writeYGValue(YGValue v) { ygvalue_buf[0] = v.value; // Store unit as integer bits in a float slot; JS reads via HEAP32. ((int*)ygvalue_buf)[1] = (int)v.unit; } EMSCRIPTEN_KEEPALIVE float* jswrap_YGValueBuffer(void) { return ygvalue_buf; } // --- YGValue getter wrappers --- EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetWidth(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetWidth(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetHeight(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetHeight(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetPosition( YGNodeConstRef node, YGEdge edge) { writeYGValue(YGNodeStyleGetPosition(node, edge)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetMargin( YGNodeConstRef node, YGEdge edge) { writeYGValue(YGNodeStyleGetMargin(node, edge)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetPadding( YGNodeConstRef node, YGEdge edge) { writeYGValue(YGNodeStyleGetPadding(node, edge)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetFlexBasis(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetFlexBasis(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetMinWidth(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetMinWidth(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetMinHeight(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetMinHeight(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetMaxWidth(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetMaxWidth(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetMaxHeight(YGNodeConstRef node) { writeYGValue(YGNodeStyleGetMaxHeight(node)); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeStyleGetGap( YGNodeConstRef node, YGGutter gutter) { writeYGValue(YGNodeStyleGetGap(node, gutter)); } // --- Measure callback bridge --- // Uses EM_JS to call into a JS-side Map stored on Module. EM_JS( float, callMeasureFunc, (YGNodeConstRef nodePtr, float width, int widthMode, float height, int heightMode, int returnWidthOrHeight), { // clang-format off var fn = Module["_yogaMeasureFuncs"].get(nodePtr); if (!fn) return 0; if (!fn._cachedResult || fn._cachedWidth !== width || fn._cachedWidthMode !== widthMode || fn._cachedHeight !== height || fn._cachedHeightMode !== heightMode) { fn._cachedResult = fn(width, widthMode, height, heightMode); fn._cachedWidth = width; fn._cachedWidthMode = widthMode; fn._cachedHeight = height; fn._cachedHeightMode = heightMode; } var result = fn._cachedResult; if (returnWidthOrHeight === 0) { var w = result.width; return (w === undefined || w === null) ? NaN : +w; } else { var h = result.height; return (h === undefined || h === null) ? NaN : +h; } // clang-format on }); static YGSize globalMeasureFunc( YGNodeConstRef nodeRef, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) { YGSize size; size.width = callMeasureFunc( nodeRef, width, (int)widthMode, height, (int)heightMode, 0); size.height = callMeasureFunc( nodeRef, width, (int)widthMode, height, (int)heightMode, 1); return size; } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeSetMeasureFunc(YGNodeRef node) { YGNodeSetMeasureFunc(node, &globalMeasureFunc); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeUnsetMeasureFunc(YGNodeRef node) { YGNodeSetMeasureFunc(node, NULL); } // --- Dirtied callback bridge --- EM_JS(void, callDirtiedFunc, (YGNodeConstRef nodePtr), { var fn = Module["_yogaDirtiedFuncs"].get(nodePtr); if (fn) fn(); }); static void globalDirtiedFunc(YGNodeConstRef nodeRef) { callDirtiedFunc(nodeRef); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeSetDirtiedFunc(YGNodeRef node) { YGNodeSetDirtiedFunc(node, &globalDirtiedFunc); } EMSCRIPTEN_KEEPALIVE void jswrap_YGNodeUnsetDirtiedFunc(YGNodeRef node) { YGNodeSetDirtiedFunc(node, NULL); } ================================================ FILE: javascript/src/wrapAssembly.ts ================================================ /** * 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. * * @format */ // @ts-nocheck import {Unit, Direction} from './generated/YGEnums.ts'; import YGEnums from './generated/YGEnums.ts'; import type { Align, BoxSizing, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Wrap, } from './generated/YGEnums.ts'; type Layout = { left: number; right: number; top: number; bottom: number; width: number; height: number; }; type Size = { width: number; height: number; }; type Value = { unit: Unit; value: number; }; export type Config = { isExperimentalFeatureEnabled(feature: ExperimentalFeature): boolean; setExperimentalFeatureEnabled( feature: ExperimentalFeature, enabled: boolean, ): void; setPointScaleFactor(factor: number): void; getErrata(): Errata; setErrata(errata: Errata): void; useWebDefaults(): boolean; setUseWebDefaults(useWebDefaults: boolean): void; }; export type DirtiedFunction = (node: Node) => void; export type MeasureFunction = ( width: number, widthMode: MeasureMode, height: number, heightMode: MeasureMode, ) => Size; export type Node = { calculateLayout( width: number | 'auto' | undefined, height: number | 'auto' | undefined, direction?: Direction, ): void; copyStyle(node: Node): void; getAlignContent(): Align; getAlignItems(): Align; getAlignSelf(): Align; getAspectRatio(): number; getBorder(edge: Edge): number; getChild(index: number): Node; getChildCount(): number; getComputedBorder(edge: Edge): number; getComputedBottom(): number; getComputedHeight(): number; getComputedLayout(): Layout; getComputedLeft(): number; getComputedMargin(edge: Edge): number; getComputedPadding(edge: Edge): number; getComputedRight(): number; getComputedTop(): number; getComputedWidth(): number; getDirection(): Direction; getDisplay(): Display; getFlexBasis(): Value; getFlexDirection(): FlexDirection; getFlexGrow(): number; getFlexShrink(): number; getFlexWrap(): Wrap; getHeight(): Value; getJustifyContent(): Justify; getGap(gutter: Gutter): Value; getMargin(edge: Edge): Value; getMaxHeight(): Value; getMaxWidth(): Value; getMinHeight(): Value; getMinWidth(): Value; getOverflow(): Overflow; getPadding(edge: Edge): Value; getParent(): Node | null; getPosition(edge: Edge): Value; getPositionType(): PositionType; getBoxSizing(): BoxSizing; getWidth(): Value; insertChild(child: Node, index: number): void; isDirty(): boolean; isReferenceBaseline(): boolean; markDirty(): void; hasNewLayout(): boolean; markLayoutSeen(): void; removeChild(child: Node): void; reset(): void; setAlignContent(alignContent: Align): void; setAlignItems(alignItems: Align): void; setAlignSelf(alignSelf: Align): void; setAspectRatio(aspectRatio: number | undefined): void; setBorder(edge: Edge, borderWidth: number | undefined): void; setDirection(direction: Direction): void; setDisplay(display: Display): void; setFlex(flex: number | undefined): void; setFlexBasis( flexBasis: | number | 'auto' | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setFlexBasisPercent(flexBasis: number | undefined): void; setFlexBasisAuto(): void; setFlexBasisFitContent(): void; setFlexBasisMaxContent(): void; setFlexBasisStretch(): void; setFlexDirection(flexDirection: FlexDirection): void; setFlexGrow(flexGrow: number | undefined): void; setFlexShrink(flexShrink: number | undefined): void; setFlexWrap(flexWrap: Wrap): void; setHeight( height: | number | 'auto' | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setIsReferenceBaseline(isReferenceBaseline: boolean): void; setHeightAuto(): void; setHeightFitContent(): void; setHeightMaxContent(): void; setHeightPercent(height: number | undefined): void; setHeightStretch(): void; setJustifyContent(justifyContent: Justify): void; setGap(gutter: Gutter, gapLength: number | `${number}%` | undefined): Value; setGapPercent(gutter: Gutter, gapLength: number | undefined): Value; setMargin( edge: Edge, margin: number | 'auto' | `${number}%` | undefined, ): void; setMarginAuto(edge: Edge): void; setMarginPercent(edge: Edge, margin: number | undefined): void; setMaxHeight( maxHeight: | number | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setMaxHeightFitContent(): void; setMaxHeightMaxContent(): void; setMaxHeightPercent(maxHeight: number | undefined): void; setMaxHeightStretch(): void; setMaxWidth( maxWidth: | number | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setMaxWidthFitContent(): void; setMaxWidthMaxContent(): void; setMaxWidthPercent(maxWidth: number | undefined): void; setMaxWidthStretch(): void; setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void; setMeasureFunc(measureFunc: MeasureFunction | null): void; setMinHeight( minHeight: | number | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setMinHeightFitContent(): void; setMinHeightMaxContent(): void; setMinHeightPercent(minHeight: number | undefined): void; setMinHeightStretch(): void; setMinWidth( minWidth: | number | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setMinWidthFitContent(): void; setMinWidthMaxContent(): void; setMinWidthPercent(minWidth: number | undefined): void; setMinWidthStretch(): void; setOverflow(overflow: Overflow): void; setPadding(edge: Edge, padding: number | `${number}%` | undefined): void; setPaddingPercent(edge: Edge, padding: number | undefined): void; setPosition(edge: Edge, position: number | `${number}%` | undefined): void; setPositionPercent(edge: Edge, position: number | undefined): void; setPositionType(positionType: PositionType): void; setPositionAuto(edge: Edge): void; setBoxSizing(boxSizing: BoxSizing): void; setWidth( width: | number | 'auto' | 'fit-content' | 'max-content' | 'stretch' | `${number}%` | undefined, ): void; setWidthAuto(): void; setWidthFitContent(): void; setWidthMaxContent(): void; setWidthPercent(width: number | undefined): void; setWidthStretch(): void; unsetDirtiedFunc(): void; unsetMeasureFunc(): void; setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void; }; export type Yoga = { Config: { create(): Config; }; Node: { create(config?: Config): Node; createDefault(): Node; createWithConfig(config: Config): Node; }; } & typeof YGEnums; // eslint-disable-next-line @typescript-eslint/no-explicit-any export default function wrapAssembly(lib: any): Yoga { // Pointer to the static YGValue return buffer (2 floats = 8 bytes). const valueBufPtr = lib._jswrap_YGValueBuffer(); // Byte offset into HEAPF32 (4 bytes per float). const valueBufIdx = valueBufPtr >> 2; // Callback maps stored on Module for EM_JS access. lib._yogaMeasureFuncs = new Map(); lib._yogaDirtiedFuncs = new Map(); function readYGValue(): Value { return { value: lib.HEAPF32[valueBufIdx], unit: lib.HEAP32[valueBufIdx + 1], }; } // --- Polymorphic setter dispatch --- // wasmPointFn is the direct WASM function for Point values, to avoid // infinite recursion (since e.g. setWidth is both the polymorphic entry // point AND what would resolve for Point suffix ''). function dispatchSetter(fnName, wasmPointFn, args) { const value = args.pop(); let unit, asNumber; if (value === 'auto') { unit = Unit.Auto; asNumber = undefined; } else if (value === 'max-content') { unit = Unit.MaxContent; asNumber = undefined; } else if (value === 'fit-content') { unit = Unit.FitContent; asNumber = undefined; } else if (value === 'stretch') { unit = Unit.Stretch; asNumber = undefined; } else if (typeof value === 'object') { unit = value.unit; asNumber = value.valueOf(); } else { unit = typeof value === 'string' && value.endsWith('%') ? Unit.Percent : Unit.Point; asNumber = parseFloat(value); if ( value !== undefined && !Number.isNaN(value) && Number.isNaN(asNumber) ) { throw new Error(`Invalid value ${value} for ${fnName}`); } } if (unit === Unit.Point) { if (asNumber !== undefined) { return wasmPointFn(this._ptr, ...args, asNumber); } else { return wasmPointFn(this._ptr, ...args); } } const suffix = { [Unit.Percent]: 'Percent', [Unit.Auto]: 'Auto', [Unit.MaxContent]: 'MaxContent', [Unit.FitContent]: 'FitContent', [Unit.Stretch]: 'Stretch', }[unit]; if (suffix === undefined) { throw new Error( `Failed to execute "${fnName}": Unsupported unit '${value}'`, ); } const method = this[`${fnName}${suffix}`]; if (!method) { throw new Error( `Failed to execute "${fnName}": Unsupported unit '${value}'`, ); } if (asNumber !== undefined) { return method.call(this, ...args, asNumber); } else { return method.call(this, ...args); } } // --- FinalizationRegistry for automatic cleanup --- const configRegistry = new FinalizationRegistry((ptr: number) => { lib._YGConfigFree(ptr); }); const nodeRegistry = new FinalizationRegistry((ptr: number) => { lib._yogaMeasureFuncs.delete(ptr); lib._yogaDirtiedFuncs.delete(ptr); lib._YGNodeFinalize(ptr); }); // --- Config class --- class ConfigImpl { _ptr: number; constructor(ptr: number) { this._ptr = ptr; configRegistry.register(this, ptr, this); } setExperimentalFeatureEnabled( feature: ExperimentalFeature, enabled: boolean, ): void { lib._YGConfigSetExperimentalFeatureEnabled( this._ptr, feature, enabled ? 1 : 0, ); } isExperimentalFeatureEnabled(feature: ExperimentalFeature): boolean { return !!lib._YGConfigIsExperimentalFeatureEnabled(this._ptr, feature); } setPointScaleFactor(factor: number): void { lib._YGConfigSetPointScaleFactor(this._ptr, factor); } getErrata(): Errata { return lib._YGConfigGetErrata(this._ptr); } setErrata(errata: Errata): void { lib._YGConfigSetErrata(this._ptr, errata); } useWebDefaults(): boolean { return !!lib._YGConfigGetUseWebDefaults(this._ptr); } setUseWebDefaults(useWebDefaults: boolean): void { lib._YGConfigSetUseWebDefaults(this._ptr, useWebDefaults ? 1 : 0); } } // --- Node class --- class NodeImpl { _ptr: number; _children: NodeImpl[]; _parent: NodeImpl | null; constructor(ptr: number) { this._ptr = ptr; this._children = []; this._parent = null; nodeRegistry.register(this, ptr, this); } // --- Tree hierarchy --- insertChild(child: NodeImpl, index: number): void { lib._YGNodeInsertChild(this._ptr, child._ptr, index); this._children.splice(index, 0, child); child._parent = this; } removeChild(child: NodeImpl): void { lib._YGNodeRemoveChild(this._ptr, child._ptr); const idx = this._children.indexOf(child); if (idx !== -1) { this._children.splice(idx, 1); } child._parent = null; } getChildCount(): number { return this._children.length; } getChild(index: number): NodeImpl { return this._children[index]; } getParent(): NodeImpl | null { return this._parent; } // --- Lifecycle --- reset(): void { lib._yogaMeasureFuncs.delete(this._ptr); lib._yogaDirtiedFuncs.delete(this._ptr); this._children = []; this._parent = null; lib._YGNodeReset(this._ptr); } // --- Style setters --- copyStyle(other: NodeImpl): void { lib._YGNodeCopyStyle(this._ptr, other._ptr); } setPositionType(positionType: PositionType): void { lib._YGNodeStyleSetPositionType(this._ptr, positionType); } setPosition(edge: Edge, position): void { dispatchSetter.call(this, 'setPosition', lib._YGNodeStyleSetPosition, [ edge, position, ]); } setPositionPercent(edge: Edge, position: number): void { lib._YGNodeStyleSetPositionPercent(this._ptr, edge, position); } setPositionAuto(edge: Edge): void { lib._YGNodeStyleSetPositionAuto(this._ptr, edge); } setAlignContent(alignContent: Align): void { lib._YGNodeStyleSetAlignContent(this._ptr, alignContent); } setAlignItems(alignItems: Align): void { lib._YGNodeStyleSetAlignItems(this._ptr, alignItems); } setAlignSelf(alignSelf: Align): void { lib._YGNodeStyleSetAlignSelf(this._ptr, alignSelf); } setFlexDirection(flexDirection: FlexDirection): void { lib._YGNodeStyleSetFlexDirection(this._ptr, flexDirection); } setFlexWrap(flexWrap: Wrap): void { lib._YGNodeStyleSetFlexWrap(this._ptr, flexWrap); } setJustifyContent(justifyContent: Justify): void { lib._YGNodeStyleSetJustifyContent(this._ptr, justifyContent); } setDirection(direction: Direction): void { lib._YGNodeStyleSetDirection(this._ptr, direction); } setMargin(edge: Edge, margin): void { dispatchSetter.call(this, 'setMargin', lib._YGNodeStyleSetMargin, [ edge, margin, ]); } setMarginPercent(edge: Edge, margin: number): void { lib._YGNodeStyleSetMarginPercent(this._ptr, edge, margin); } setMarginAuto(edge: Edge): void { lib._YGNodeStyleSetMarginAuto(this._ptr, edge); } setOverflow(overflow: Overflow): void { lib._YGNodeStyleSetOverflow(this._ptr, overflow); } setDisplay(display: Display): void { lib._YGNodeStyleSetDisplay(this._ptr, display); } setFlex(flex: number): void { lib._YGNodeStyleSetFlex(this._ptr, flex); } setFlexBasis(flexBasis): void { dispatchSetter.call(this, 'setFlexBasis', lib._YGNodeStyleSetFlexBasis, [ flexBasis, ]); } setFlexBasisPercent(flexBasis: number): void { lib._YGNodeStyleSetFlexBasisPercent(this._ptr, flexBasis); } setFlexBasisAuto(): void { lib._YGNodeStyleSetFlexBasisAuto(this._ptr); } setFlexBasisMaxContent(): void { lib._YGNodeStyleSetFlexBasisMaxContent(this._ptr); } setFlexBasisFitContent(): void { lib._YGNodeStyleSetFlexBasisFitContent(this._ptr); } setFlexBasisStretch(): void { lib._YGNodeStyleSetFlexBasisStretch(this._ptr); } setFlexGrow(flexGrow: number): void { lib._YGNodeStyleSetFlexGrow(this._ptr, flexGrow); } setFlexShrink(flexShrink: number): void { lib._YGNodeStyleSetFlexShrink(this._ptr, flexShrink); } setWidth(width): void { dispatchSetter.call(this, 'setWidth', lib._YGNodeStyleSetWidth, [width]); } setWidthPercent(width: number): void { lib._YGNodeStyleSetWidthPercent(this._ptr, width); } setWidthAuto(): void { lib._YGNodeStyleSetWidthAuto(this._ptr); } setWidthMaxContent(): void { lib._YGNodeStyleSetWidthMaxContent(this._ptr); } setWidthFitContent(): void { lib._YGNodeStyleSetWidthFitContent(this._ptr); } setWidthStretch(): void { lib._YGNodeStyleSetWidthStretch(this._ptr); } setHeight(height): void { dispatchSetter.call(this, 'setHeight', lib._YGNodeStyleSetHeight, [ height, ]); } setHeightPercent(height: number): void { lib._YGNodeStyleSetHeightPercent(this._ptr, height); } setHeightAuto(): void { lib._YGNodeStyleSetHeightAuto(this._ptr); } setHeightMaxContent(): void { lib._YGNodeStyleSetHeightMaxContent(this._ptr); } setHeightFitContent(): void { lib._YGNodeStyleSetHeightFitContent(this._ptr); } setHeightStretch(): void { lib._YGNodeStyleSetHeightStretch(this._ptr); } setMinWidth(minWidth): void { dispatchSetter.call(this, 'setMinWidth', lib._YGNodeStyleSetMinWidth, [ minWidth, ]); } setMinWidthPercent(minWidth: number): void { lib._YGNodeStyleSetMinWidthPercent(this._ptr, minWidth); } setMinWidthMaxContent(): void { lib._YGNodeStyleSetMinWidthMaxContent(this._ptr); } setMinWidthFitContent(): void { lib._YGNodeStyleSetMinWidthFitContent(this._ptr); } setMinWidthStretch(): void { lib._YGNodeStyleSetMinWidthStretch(this._ptr); } setMinHeight(minHeight): void { dispatchSetter.call(this, 'setMinHeight', lib._YGNodeStyleSetMinHeight, [ minHeight, ]); } setMinHeightPercent(minHeight: number): void { lib._YGNodeStyleSetMinHeightPercent(this._ptr, minHeight); } setMinHeightMaxContent(): void { lib._YGNodeStyleSetMinHeightMaxContent(this._ptr); } setMinHeightFitContent(): void { lib._YGNodeStyleSetMinHeightFitContent(this._ptr); } setMinHeightStretch(): void { lib._YGNodeStyleSetMinHeightStretch(this._ptr); } setMaxWidth(maxWidth): void { dispatchSetter.call(this, 'setMaxWidth', lib._YGNodeStyleSetMaxWidth, [ maxWidth, ]); } setMaxWidthPercent(maxWidth: number): void { lib._YGNodeStyleSetMaxWidthPercent(this._ptr, maxWidth); } setMaxWidthMaxContent(): void { lib._YGNodeStyleSetMaxWidthMaxContent(this._ptr); } setMaxWidthFitContent(): void { lib._YGNodeStyleSetMaxWidthFitContent(this._ptr); } setMaxWidthStretch(): void { lib._YGNodeStyleSetMaxWidthStretch(this._ptr); } setMaxHeight(maxHeight): void { dispatchSetter.call(this, 'setMaxHeight', lib._YGNodeStyleSetMaxHeight, [ maxHeight, ]); } setMaxHeightPercent(maxHeight: number): void { lib._YGNodeStyleSetMaxHeightPercent(this._ptr, maxHeight); } setMaxHeightMaxContent(): void { lib._YGNodeStyleSetMaxHeightMaxContent(this._ptr); } setMaxHeightFitContent(): void { lib._YGNodeStyleSetMaxHeightFitContent(this._ptr); } setMaxHeightStretch(): void { lib._YGNodeStyleSetMaxHeightStretch(this._ptr); } setAspectRatio(aspectRatio: number): void { lib._YGNodeStyleSetAspectRatio(this._ptr, aspectRatio); } setBorder(edge: Edge, border: number): void { lib._YGNodeStyleSetBorder(this._ptr, edge, border); } setPadding(edge: Edge, padding): void { dispatchSetter.call(this, 'setPadding', lib._YGNodeStyleSetPadding, [ edge, padding, ]); } setPaddingPercent(edge: Edge, padding: number): void { lib._YGNodeStyleSetPaddingPercent(this._ptr, edge, padding); } setGap(gutter: Gutter, gapLength): void { dispatchSetter.call(this, 'setGap', lib._YGNodeStyleSetGap, [ gutter, gapLength, ]); } setGapPercent(gutter: Gutter, gapLength: number): void { lib._YGNodeStyleSetGapPercent(this._ptr, gutter, gapLength); } setBoxSizing(boxSizing: BoxSizing): void { lib._YGNodeStyleSetBoxSizing(this._ptr, boxSizing); } setIsReferenceBaseline(isReferenceBaseline: boolean): void { lib._YGNodeSetIsReferenceBaseline(this._ptr, isReferenceBaseline ? 1 : 0); } setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void { lib._YGNodeSetAlwaysFormsContainingBlock( this._ptr, alwaysFormsContainingBlock ? 1 : 0, ); } // --- Style getters --- getPositionType(): PositionType { return lib._YGNodeStyleGetPositionType(this._ptr); } getPosition(edge: Edge): Value { lib._jswrap_YGNodeStyleGetPosition(this._ptr, edge); return readYGValue(); } getAlignContent(): Align { return lib._YGNodeStyleGetAlignContent(this._ptr); } getAlignItems(): Align { return lib._YGNodeStyleGetAlignItems(this._ptr); } getAlignSelf(): Align { return lib._YGNodeStyleGetAlignSelf(this._ptr); } getFlexDirection(): FlexDirection { return lib._YGNodeStyleGetFlexDirection(this._ptr); } getFlexWrap(): Wrap { return lib._YGNodeStyleGetFlexWrap(this._ptr); } getJustifyContent(): Justify { return lib._YGNodeStyleGetJustifyContent(this._ptr); } getDirection(): Direction { return lib._YGNodeStyleGetDirection(this._ptr); } getMargin(edge: Edge): Value { lib._jswrap_YGNodeStyleGetMargin(this._ptr, edge); return readYGValue(); } getOverflow(): Overflow { return lib._YGNodeStyleGetOverflow(this._ptr); } getDisplay(): Display { return lib._YGNodeStyleGetDisplay(this._ptr); } getFlexBasis(): Value { lib._jswrap_YGNodeStyleGetFlexBasis(this._ptr); return readYGValue(); } getFlexGrow(): number { return lib._YGNodeStyleGetFlexGrow(this._ptr); } getFlexShrink(): number { return lib._YGNodeStyleGetFlexShrink(this._ptr); } getWidth(): Value { lib._jswrap_YGNodeStyleGetWidth(this._ptr); return readYGValue(); } getHeight(): Value { lib._jswrap_YGNodeStyleGetHeight(this._ptr); return readYGValue(); } getMinWidth(): Value { lib._jswrap_YGNodeStyleGetMinWidth(this._ptr); return readYGValue(); } getMinHeight(): Value { lib._jswrap_YGNodeStyleGetMinHeight(this._ptr); return readYGValue(); } getMaxWidth(): Value { lib._jswrap_YGNodeStyleGetMaxWidth(this._ptr); return readYGValue(); } getMaxHeight(): Value { lib._jswrap_YGNodeStyleGetMaxHeight(this._ptr); return readYGValue(); } getAspectRatio(): number { return lib._YGNodeStyleGetAspectRatio(this._ptr); } getBorder(edge: Edge): number { return lib._YGNodeStyleGetBorder(this._ptr, edge); } getPadding(edge: Edge): Value { lib._jswrap_YGNodeStyleGetPadding(this._ptr, edge); return readYGValue(); } getGap(gutter: Gutter): Value { lib._jswrap_YGNodeStyleGetGap(this._ptr, gutter); return readYGValue(); } getBoxSizing(): BoxSizing { return lib._YGNodeStyleGetBoxSizing(this._ptr); } isReferenceBaseline(): boolean { return !!lib._YGNodeIsReferenceBaseline(this._ptr); } // --- Measure / Dirtied --- setMeasureFunc(measureFunc: MeasureFunction | null): void { if (measureFunc) { lib._yogaMeasureFuncs.set(this._ptr, measureFunc); lib._jswrap_YGNodeSetMeasureFunc(this._ptr); } else { this.unsetMeasureFunc(); } } unsetMeasureFunc(): void { lib._yogaMeasureFuncs.delete(this._ptr); lib._jswrap_YGNodeUnsetMeasureFunc(this._ptr); } setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void { if (dirtiedFunc) { const nodeWeakRef = new WeakRef(this); lib._yogaDirtiedFuncs.set(this._ptr, () => { const node = nodeWeakRef.deref(); if (node) dirtiedFunc(node); }); lib._jswrap_YGNodeSetDirtiedFunc(this._ptr); } else { this.unsetDirtiedFunc(); } } unsetDirtiedFunc(): void { lib._yogaDirtiedFuncs.delete(this._ptr); lib._jswrap_YGNodeUnsetDirtiedFunc(this._ptr); } // --- Dirty / Layout --- markDirty(): void { lib._YGNodeMarkDirty(this._ptr); } isDirty(): boolean { return !!lib._YGNodeIsDirty(this._ptr); } markLayoutSeen(): void { lib._YGNodeSetHasNewLayout(this._ptr, 0); } hasNewLayout(): boolean { return !!lib._YGNodeGetHasNewLayout(this._ptr); } calculateLayout( width: number | 'auto' | undefined = NaN, height: number | 'auto' | undefined = NaN, direction: Direction = Direction.LTR, ): void { lib._YGNodeCalculateLayout(this._ptr, width, height, direction); } // --- Layout getters --- getComputedLeft(): number { return lib._YGNodeLayoutGetLeft(this._ptr); } getComputedRight(): number { return lib._YGNodeLayoutGetRight(this._ptr); } getComputedTop(): number { return lib._YGNodeLayoutGetTop(this._ptr); } getComputedBottom(): number { return lib._YGNodeLayoutGetBottom(this._ptr); } getComputedWidth(): number { return lib._YGNodeLayoutGetWidth(this._ptr); } getComputedHeight(): number { return lib._YGNodeLayoutGetHeight(this._ptr); } getComputedLayout(): Layout { return { left: lib._YGNodeLayoutGetLeft(this._ptr), right: lib._YGNodeLayoutGetRight(this._ptr), top: lib._YGNodeLayoutGetTop(this._ptr), bottom: lib._YGNodeLayoutGetBottom(this._ptr), width: lib._YGNodeLayoutGetWidth(this._ptr), height: lib._YGNodeLayoutGetHeight(this._ptr), }; } getComputedMargin(edge: Edge): number { return lib._YGNodeLayoutGetMargin(this._ptr, edge); } getComputedBorder(edge: Edge): number { return lib._YGNodeLayoutGetBorder(this._ptr, edge); } getComputedPadding(edge: Edge): number { return lib._YGNodeLayoutGetPadding(this._ptr, edge); } } return { Config: { create(): Config { return new ConfigImpl(lib._YGConfigNew()); }, }, Node: { create(config?: Config): Node { if (config) { return new NodeImpl( lib._YGNodeNewWithConfig((config as ConfigImpl)._ptr), ); } return new NodeImpl(lib._YGNodeNew()); }, createDefault(): Node { return new NodeImpl(lib._YGNodeNew()); }, createWithConfig(config: Config): Node { return new NodeImpl( lib._YGNodeNewWithConfig((config as ConfigImpl)._ptr), ); }, }, ...YGEnums, }; } ================================================ FILE: javascript/tests/Benchmarks/YGBenchmark.test.ts ================================================ /** * 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. */ import {getMeasureCounter} from '../tools/MeasureCounter.ts'; import {YGBENCHMARK} from '../tools/globals.ts'; import Yoga from 'yoga-layout'; const ITERATIONS = 2000; YGBENCHMARK('Stack with flex', () => { const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); const measureCounter = getMeasureCounter(); for (let i = 0; i < ITERATIONS; i++) { const child = Yoga.Node.create(); child.setMeasureFunc(measureCounter.inc); child.setFlex(1); root.insertChild(child, 0); } root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); }); YGBENCHMARK('Align stretch in undefined axis', () => { const root = Yoga.Node.create(); const measureCounter = getMeasureCounter(); for (let i = 0; i < ITERATIONS; i++) { const child = Yoga.Node.create(); child.setMeasureFunc(measureCounter.inc); child.setHeight(20); root.insertChild(child, 0); } root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); }); YGBENCHMARK('Nested flex', () => { const root = Yoga.Node.create(); const measureCounter = getMeasureCounter(); const iterations = Math.pow(ITERATIONS, 1 / 2); for (let i = 0; i < iterations; i++) { const child = Yoga.Node.create(); child.setFlex(1); root.insertChild(child, 0); for (let ii = 0; ii < iterations; ii++) { const grandChild = Yoga.Node.create(); grandChild.setMeasureFunc(measureCounter.inc); grandChild.setFlex(1); child.insertChild(grandChild, 0); } } root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); }); YGBENCHMARK('Huge nested layout', () => { const root = Yoga.Node.create(); const iterations = Math.pow(ITERATIONS, 1 / 4); for (let i = 0; i < iterations; i++) { const child = Yoga.Node.create(); child.setFlexGrow(1); child.setWidth(10); child.setHeight(10); root.insertChild(child, 0); for (let ii = 0; ii < iterations; ii++) { const grandChild = Yoga.Node.create(); grandChild.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); grandChild.setFlexGrow(1); grandChild.setWidth(10); grandChild.setHeight(10); child.insertChild(grandChild, 0); for (let iii = 0; iii < iterations; iii++) { const grandGrandChild = Yoga.Node.create(); grandGrandChild.setFlexGrow(1); grandGrandChild.setWidth(10); grandGrandChild.setHeight(10); grandChild.insertChild(grandGrandChild, 0); for (let iiii = 0; iiii < iterations; iiii++) { const grandGrandGrandChild = Yoga.Node.create(); grandGrandGrandChild.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); grandGrandGrandChild.setFlexGrow(1); grandGrandGrandChild.setWidth(10); grandGrandGrandChild.setHeight(10); grandGrandChild.insertChild(grandGrandGrandChild, 0); } } } } root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); }); ================================================ FILE: javascript/tests/YGAlignBaselineTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('align_baseline_parent_using_child_in_column_as_reference', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(1000); root.setHeight(1000); root.setAlignItems(Yoga.ALIGN_BASELINE); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child0.setWidth(500); root_child0.setHeight(600); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1.setWidth(500); root_child1.setHeight(800); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child0.setWidth(500); root_child1_child0.setHeight(300); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child1.setWidth(500); root_child1_child1.setHeight(400); root_child1_child1.setIsReferenceBaseline(true); root_child1.insertChild(root_child1_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child1.getComputedLeft()).toBe(500); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedLeft()).toBe(0); expect(root_child1_child1.getComputedTop()).toBe(300); }); test('align_baseline_parent_using_child_in_row_as_reference', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(1000); root.setHeight(1000); root.setAlignItems(Yoga.ALIGN_BASELINE); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child0.setWidth(500); root_child0.setHeight(600); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child1.setWidth(500); root_child1.setHeight(800); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child0.setWidth(500); root_child1_child0.setHeight(500); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child1.setWidth(500); root_child1_child1.setHeight(400); root_child1_child1.setIsReferenceBaseline(true); root_child1.insertChild(root_child1_child1, 1); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child1.getComputedLeft()).toBe(500); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedLeft()).toBe(500); expect(root_child1_child1.getComputedTop()).toBe(0); }); ================================================ FILE: javascript/tests/YGComputedBorderTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('border_start', () => { const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); root.setBorder(Yoga.EDGE_START, 10); root.calculateLayout(100, 100, Yoga.DIRECTION_LTR); expect(root.getComputedBorder(Yoga.EDGE_LEFT)).toBe(10); expect(root.getComputedBorder(Yoga.EDGE_RIGHT)).toBe(0); root.calculateLayout(100, 100, Yoga.DIRECTION_RTL); expect(root.getComputedBorder(Yoga.EDGE_LEFT)).toBe(0); expect(root.getComputedBorder(Yoga.EDGE_RIGHT)).toBe(10); }); ================================================ FILE: javascript/tests/YGComputedMarginTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('margin_start', () => { const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); root.setMargin(Yoga.EDGE_START, `10%`); root.calculateLayout(100, 100, Yoga.DIRECTION_LTR); expect(root.getComputedMargin(Yoga.EDGE_LEFT)).toBe(10); expect(root.getComputedMargin(Yoga.EDGE_RIGHT)).toBe(0); root.calculateLayout(100, 100, Yoga.DIRECTION_RTL); expect(root.getComputedMargin(Yoga.EDGE_LEFT)).toBe(0); expect(root.getComputedMargin(Yoga.EDGE_RIGHT)).toBe(10); }); ================================================ FILE: javascript/tests/YGComputedPaddingTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('padding_start', () => { const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); root.setPadding(Yoga.EDGE_START, `10%`); root.calculateLayout(100, 100, Yoga.DIRECTION_LTR); expect(root.getComputedPadding(Yoga.EDGE_LEFT)).toBe(10); expect(root.getComputedPadding(Yoga.EDGE_RIGHT)).toBe(0); root.calculateLayout(100, 100, Yoga.DIRECTION_RTL); expect(root.getComputedPadding(Yoga.EDGE_LEFT)).toBe(0); expect(root.getComputedPadding(Yoga.EDGE_RIGHT)).toBe(10); }); ================================================ FILE: javascript/tests/YGDirtiedTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('dirtied', () => { const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); let dirtied = 0; root.setDirtiedFunc(() => { dirtied++; }); // only nodes with a measure function can be marked dirty root.setMeasureFunc(() => ({width: 0, height: 0})); expect(dirtied).toBe(0); // dirtied func MUST be called in case of explicit dirtying. root.markDirty(); expect(dirtied).toBe(1); // dirtied func MUST be called ONCE. root.markDirty(); expect(dirtied).toBe(1); }); test('dirtied_propagation', () => { const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root_child0.setWidth(50); root_child0.setHeight(20); root_child0.setMeasureFunc(() => ({width: 0, height: 0})); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(); root_child1.setAlignItems(Yoga.ALIGN_FLEX_START); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); let dirtied = 0; root.setDirtiedFunc(() => { dirtied++; }); expect(dirtied).toBe(0); // dirtied func MUST be called for the first time. root_child0.markDirty(); expect(dirtied).toBe(1); // dirtied func must NOT be called for the second time. root_child0.markDirty(); expect(dirtied).toBe(1); }); test('dirtied_hierarchy', () => { const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root_child0.setWidth(50); root_child0.setHeight(20); root_child0.setMeasureFunc(() => ({width: 0, height: 0})); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(); root_child1.setAlignItems(Yoga.ALIGN_FLEX_START); root_child1.setWidth(50); root_child1.setHeight(20); root_child0.setMeasureFunc(() => ({width: 0, height: 0})); root.insertChild(root_child1, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); let dirtied = 0; root_child0.setDirtiedFunc(() => { dirtied++; }); expect(dirtied).toBe(0); // dirtied func must NOT be called for descendants. // NOTE: nodes without a measure function cannot be marked dirty manually, // but nodes with a measure function can not have children. // Update the width to dirty the node instead. root.setWidth(110); expect(dirtied).toBe(0); // dirtied func MUST be called in case of explicit dirtying. root_child0.markDirty(); expect(dirtied).toBe(1); }); test('dirtied_reset', () => { const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); root.setMeasureFunc(() => ({width: 0, height: 0})); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); let dirtied = 0; root.setDirtiedFunc(() => { dirtied++; }); expect(dirtied).toBe(0); // dirtied func MUST be called in case of explicit dirtying. root.markDirty(); expect(dirtied).toBe(1); // recalculate so the root is no longer dirty root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); root.reset(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); root.setMeasureFunc(() => ({width: 0, height: 0})); root.markDirty(); // dirtied func must NOT be called after reset. root.markDirty(); expect(dirtied).toBe(1); }); ================================================ FILE: javascript/tests/YGErrataTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('errata_all_contains_example_errata', () => { const config = Yoga.Config.create(); config.setErrata(Yoga.ERRATA_ALL); expect(config.getErrata()).toBe(Yoga.ERRATA_ALL); expect(config.getErrata() & Yoga.ERRATA_STRETCH_FLEX_BASIS).not.toBe(0); }); test('errata_none_omits_example_errata', () => { const config = Yoga.Config.create(); config.setErrata(Yoga.ERRATA_NONE); expect(config.getErrata()).toBe(Yoga.ERRATA_NONE); expect(config.getErrata() & Yoga.ERRATA_STRETCH_FLEX_BASIS).toBe(0); }); test('errata_is_settable', () => { const config = Yoga.Config.create(); config.setErrata(Yoga.ERRATA_ALL); expect(config.getErrata()).toBe(Yoga.ERRATA_ALL); config.setErrata(Yoga.ERRATA_NONE); expect(config.getErrata()).toBe(Yoga.ERRATA_NONE); }); ================================================ FILE: javascript/tests/YGFlexBasisAuto.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('flex_basis_auto', () => { const root = Yoga.Node.create(); expect(root.getFlexBasis().unit).toBe(Yoga.UNIT_AUTO); root.setFlexBasis(10); expect(root.getFlexBasis().unit).toBe(Yoga.UNIT_POINT); expect(root.getFlexBasis().value).toBe(10); root.setFlexBasisAuto(); expect(root.getFlexBasis().unit).toBe(Yoga.UNIT_AUTO); }); ================================================ FILE: javascript/tests/YGHasNewLayout.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; test('new_layout_can_be_marked_seen', () => { const root = Yoga.Node.create(); root.markLayoutSeen(); expect(root.hasNewLayout()).toBe(false); }); test('new_layout_calculating_layout_marks_layout_as_unseen', () => { const root = Yoga.Node.create(); root.markLayoutSeen(); root.calculateLayout(undefined, undefined); expect(root.hasNewLayout()).toBe(true); }); test('new_layout_calculated_layout_can_be_marked_seen', () => { const root = Yoga.Node.create(); root.calculateLayout(undefined, undefined); root.markLayoutSeen(); expect(root.hasNewLayout()).toBe(false); }); test('new_layout_recalculating_layout_does_mark_as_unseen', () => { const root = Yoga.Node.create(); root.calculateLayout(undefined, undefined); root.markLayoutSeen(); root.calculateLayout(undefined, undefined); expect(root.hasNewLayout()).toBe(true); }); test('new_layout_reset_also_resets_layout_seen', () => { const root = Yoga.Node.create(); root.markLayoutSeen(); root.reset(); expect(root.hasNewLayout()).toBe(true); }); test('new_layout_children_sets_new_layout', () => { const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root_child0.setWidth(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(); root_child1.setAlignItems(Yoga.ALIGN_FLEX_START); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 0); expect(root.hasNewLayout()).toEqual(true); expect(root_child0.hasNewLayout()).toEqual(true); expect(root_child1.hasNewLayout()).toEqual(true); root.markLayoutSeen(); root_child0.markLayoutSeen(); root_child1.markLayoutSeen(); expect(root.hasNewLayout()).toEqual(false); expect(root_child0.hasNewLayout()).toEqual(false); expect(root_child1.hasNewLayout()).toEqual(false); root_child1.setHeight(30); root.calculateLayout(undefined, undefined); expect(root.hasNewLayout()).toEqual(true); expect(root_child0.hasNewLayout()).toEqual(true); expect(root_child1.hasNewLayout()).toEqual(true); }); ================================================ FILE: javascript/tests/YGMeasureCacheTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; import {getMeasureCounterMax} from './tools/MeasureCounter.ts'; test('measure_once_single_flexible_child', () => { const root = Yoga.Node.create(); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); const measureCounter = getMeasureCounterMax(); const root_child0 = Yoga.Node.create(); root_child0.setMeasureFunc(measureCounter.inc); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(measureCounter.get()).toBe(1); }); ================================================ FILE: javascript/tests/YGMeasureTest.test.ts ================================================ /** * 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. */ import Yoga from 'yoga-layout'; import {getMeasureCounter} from './tools/MeasureCounter.ts'; test('dont_measure_single_grow_shrink_child', () => { const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); const measureCounter = getMeasureCounter(null, 100, 100); const root_child0 = Yoga.Node.create(); root_child0.setMeasureFunc(measureCounter.inc); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(measureCounter.get()).toBe(0); }); test('dont_fail_with_incomplete_measure_dimensions', () => { // @ts-expect-error Testing bad usage const heightOnlyCallback = getMeasureCounter(() => ({height: 10})); // @ts-expect-error Testing bad usage const widthOnlyCallback = getMeasureCounter(() => ({width: 10})); // @ts-expect-error Testing bad usage const emptyCallback = getMeasureCounter(() => ({})); const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); const node1 = Yoga.Node.create(); const node2 = Yoga.Node.create(); const node3 = Yoga.Node.create(); root.insertChild(node1, root.getChildCount()); root.insertChild(node2, root.getChildCount()); root.insertChild(node3, root.getChildCount()); node1.setMeasureFunc(heightOnlyCallback.inc); node2.setMeasureFunc(widthOnlyCallback.inc); node3.setMeasureFunc(emptyCallback.inc); root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); expect(heightOnlyCallback.get()).toBe(1); expect(widthOnlyCallback.get()).toBe(1); expect(emptyCallback.get()).toBe(1); expect(node1.getComputedWidth()).toBe(100); expect(node1.getComputedHeight()).toBe(10); expect(node2.getComputedWidth()).toBe(100); expect(node2.getComputedHeight()).toBe(0); expect(node3.getComputedWidth()).toBe(100); expect(node3.getComputedHeight()).toBe(0); }); ================================================ FILE: javascript/tests/bin/run-bench.ts ================================================ #!/usr/bin/env ts-node /** * 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. * * @format */ import path from 'path'; const WARMUP_ITERATIONS = 3; const BENCHMARK_ITERATIONS = 10; const testFiles = process.argv.slice(2); const testResults = new Map>(); for (const type of ['wasm']) { for (const file of testFiles) { globalThis.YGBENCHMARK = (name: string, fn: () => void) => { let testEntry = testResults.get(name); if (testEntry === undefined) testResults.set(name, (testEntry = new Map())); for (let t = 0; t < WARMUP_ITERATIONS; ++t) fn(); const start = Date.now(); for (let t = 0; t < BENCHMARK_ITERATIONS; ++t) fn(); const end = Date.now(); testEntry.set(type, (end - start) / BENCHMARK_ITERATIONS); }; const modulePath = path.resolve(file); await import(modulePath); } } console.log( `Note: those tests are independants; there is no time relation to be expected between them`, ); for (const [name, results] of testResults) { console.log(); const min = Math.min(Infinity, ...results.values()); console.log(name); for (const [type, result] of results) { console.log( ` - ${type}: ${result}ms (${Math.round((result / min) * 10000) / 100}%)`, ); } } ================================================ FILE: javascript/tests/generated/YGAbsolutePositionTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAbsolutePositionTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('absolute_layout_width_height_start_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Start, 10); root_child0.setPosition(Edge.Top, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('absolute_layout_width_height_left_auto_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root_child0.setPositionType(PositionType.Absolute); root_child0.setPositionAuto(Edge.Left); root_child0.setPosition(Edge.Right, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('absolute_layout_width_height_left_right_auto', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Left, 10); root_child0.setPositionAuto(Edge.Right); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('absolute_layout_width_height_left_auto_right_auto', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root_child0.setPositionType(PositionType.Absolute); root_child0.setPositionAuto(Edge.Left); root_child0.setPositionAuto(Edge.Right); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('absolute_layout_width_height_end_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.End, 10); root_child0.setPosition(Edge.Bottom, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('absolute_layout_start_top_end_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Start, 10); root_child0.setPosition(Edge.Top, 10); root_child0.setPosition(Edge.End, 10); root_child0.setPosition(Edge.Bottom, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(80); }); test('absolute_layout_width_height_start_top_end_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Start, 10); root_child0.setPosition(Edge.Top, 10); root_child0.setPosition(Edge.End, 10); root_child0.setPosition(Edge.Bottom, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(50); root.setWidth(50); root.setOverflow(Overflow.Hidden); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Start, 0); root_child0.setPosition(Edge.Top, 0); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0_child0.setHeight(100); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(-50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); }); test('absolute_layout_within_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setBorder(Edge.All, 10); root.setMargin(Edge.All, 10); root.setPadding(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setPosition(Edge.Left, 0); root_child0.setPosition(Edge.Top, 0); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setPositionType(PositionType.Absolute); root_child1.setWidth(50); root_child1.setHeight(50); root_child1.setPosition(Edge.Right, 0); root_child1.setPosition(Edge.Bottom, 0); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setPositionType(PositionType.Absolute); root_child2.setWidth(50); root_child2.setHeight(50); root_child2.setPosition(Edge.Left, 0); root_child2.setPosition(Edge.Top, 0); root_child2.setMargin(Edge.All, 10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setPositionType(PositionType.Absolute); root_child3.setWidth(50); root_child3.setHeight(50); root_child3.setPosition(Edge.Right, 0); root_child3.setPosition(Edge.Bottom, 0); root_child3.setMargin(Edge.All, 10); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(10); expect(root.getComputedTop()).toBe(10); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(30); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(10); expect(root.getComputedTop()).toBe(10); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(30); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); }); test('absolute_layout_align_items_and_justify_content_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_and_justify_content_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.FlexEnd); root.setJustifyContent(Justify.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_justify_content_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_center_on_child_only', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root_child0.setAlignSelf(Align.Center); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_and_justify_content_center_and_top_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root_child0.setPosition(Edge.Top, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_and_justify_content_center_and_bottom_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root_child0.setPosition(Edge.Bottom, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_and_justify_content_center_and_left_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root_child0.setPosition(Edge.Left, 5); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('absolute_layout_align_items_and_justify_content_center_and_right_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(110); root.setFlexGrow(1); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(60); root_child0.setHeight(40); root_child0.setPosition(Edge.Right, 5); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(40); }); test('position_root_with_rtl_should_position_withoutdirection', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setPosition(Edge.Left, 72); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(72); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(72); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); }); test('absolute_layout_percentage_bottom_based_on_parent_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Top, "50%"); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setPositionType(PositionType.Absolute); root_child1.setPosition(Edge.Bottom, "50%"); root_child1.setWidth(10); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setPositionType(PositionType.Absolute); root_child2.setPosition(Edge.Top, "10%"); root_child2.setWidth(10); root_child2.setPosition(Edge.Bottom, "10%"); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(90); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(160); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(90); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(160); }); test('absolute_layout_in_wrap_reverse_column_container', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexWrap(Wrap.WrapReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('absolute_layout_in_wrap_reverse_row_container', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(100); root.setHeight(100); root.setFlexWrap(Wrap.WrapReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('absolute_layout_in_wrap_reverse_column_container_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexWrap(Wrap.WrapReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setPositionType(PositionType.Absolute); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('absolute_layout_in_wrap_reverse_row_container_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(100); root.setHeight(100); root.setFlexWrap(Wrap.WrapReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setPositionType(PositionType.Absolute); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('percent_absolute_position_infinite_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(300); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth("20%"); root_child1.setHeight("20%"); root_child1.setPosition(Edge.Left, "20%"); root_child1.setPosition(Edge.Top, "20%"); root_child1.setPositionType(PositionType.Absolute); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(0); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(300); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(60); expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(0); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(300); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(60); expect(root_child1.getComputedHeight()).toBe(0); }); test('absolute_layout_percentage_height_based_on_padded_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.Top, 10); root.setBorder(Edge.Top, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight("50%"); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(45); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(45); }); test('absolute_layout_percentage_height_based_on_padded_parent_and_align_items_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.Top, 20); root.setPadding(Edge.Bottom, 20); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(100); root_child0.setHeight("50%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(25); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(25); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_padding_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setPadding(Edge.Left, 100); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_padding_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setPadding(Edge.Right, 100); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_padding_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setPadding(Edge.Top, 100); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_padding_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setPadding(Edge.Bottom, 100); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setMargin(Edge.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setWidth(200); root_child0_child0.setHeight(200); root_child0_child0.setPadding(Edge.All, 50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setHeight(50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(220); expect(root.getComputedHeight()).toBe(220); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(220); expect(root.getComputedHeight()).toBe(220); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setMargin(Edge.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setWidth(200); root_child0_child0.setHeight(200); root_child0_child0.setBorder(Edge.All, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setHeight(50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(220); expect(root.getComputedHeight()).toBe(220); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(220); expect(root.getComputedHeight()).toBe(220); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(140); expect(root_child0_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('absolute_layout_column_reverse_margin_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.ColumnReverse); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setPosition(Edge.Left, 5); root_child0.setPosition(Edge.Right, 3); root_child0.setMargin(Edge.Right, 4); root_child0.setMargin(Edge.Left, 3); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Left, 1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(8); expect(root_child0.getComputedTop()).toBe(150); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(143); expect(root_child0.getComputedTop()).toBe(150); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); }); ================================================ FILE: javascript/tests/generated/YGAlignContentTest.test.ts ================================================ /** * 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<<37aacf42a46e0f084340980d45ce7004>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAlignContentTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('align_content_flex_start_nowrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_flex_start_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(10); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(20); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(10); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(20); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_flex_start_wrap_singleline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_flex_start_wrapped_negative_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_flex_start_wrapped_negative_space_gap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root_child0.setGap(Gutter.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_flex_start_without_height_on_children', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(10); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(20); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(10); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(20); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(0); }); test('align_content_flex_start_with_flex', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setFlexGrow(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setFlexGrow(1); root_child1.setFlexBasis("0%"); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setFlexGrow(1); root_child3.setFlexShrink(1); root_child3.setFlexBasis("0%"); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(40); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(120); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(40); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(120); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(0); }); test('align_content_flex_end_nowrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_flex_end_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(90); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(90); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(110); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(90); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(90); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(110); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_flex_end_wrap_singleline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(110); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(110); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(110); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(110); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_flex_end_wrapped_negative_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.FlexEnd); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(-10); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(-10); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_flex_end_wrapped_negative_space_gap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.FlexEnd); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root_child0.setGap(Gutter.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-70); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-40); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(-10); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-70); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-40); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(-10); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_center_nowrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_center_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(45); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(45); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(65); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(45); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(45); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(65); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_center_wrap_singleline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(55); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(55); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_center_wrapped_negative_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.Center); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-25); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-5); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(15); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-25); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-5); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(15); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_center_wrapped_negative_space_gap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.Center); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root_child0.setGap(Gutter.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-35); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-5); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(25); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(-35); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(-5); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(25); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_between_nowrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceBetween); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_space_between_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceBetween); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(110); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(110); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_space_between_wrap_singleline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceBetween); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_space_between_wrapped_negative_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceBetween); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_between_wrapped_negative_space_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceBetween); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_between_wrapped_negative_space_gap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceBetween); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root_child0.setGap(Gutter.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_around_nowrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_space_around_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(15); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(95); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(15); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(95); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_space_around_wrap_singleline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(55); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(55); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_space_around_wrapped_negative_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceAround); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_around_wrapped_negative_space_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceAround); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_around_wrapped_negative_space_gap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceAround); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root_child0.setGap(Gutter.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_evenly_nowrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_space_evenly_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(23); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(23); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(88); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(23); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(23); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(55); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(55); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(88); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_space_evenly_wrap_singleline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(140); root.setHeight(120); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(55); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(120); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(55); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(10); }); test('align_content_space_evenly_wrapped_negative_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceEvenly); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(20); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(40); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_space_evenly_wrapped_negative_space_gap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setHeight(320); root.setBorder(Edge.All, 60); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setAlignContent(Align.SpaceEvenly); root_child0.setJustifyContent(Justify.Center); root_child0.setHeight(10); root_child0.setGap(Gutter.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("80%"); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("80%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth("80%"); root_child0_child2.setHeight(20); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(60); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child1.getComputedLeft()).toBe(20); expect(root_child0_child1.getComputedTop()).toBe(30); expect(root_child0_child1.getComputedWidth()).toBe(160); expect(root_child0_child1.getComputedHeight()).toBe(20); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(60); expect(root_child0_child2.getComputedWidth()).toBe(160); expect(root_child0_child2.getComputedHeight()).toBe(20); }); test('align_content_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(0); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(0); expect(root_child4.getComputedLeft()).toBe(100); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(0); }); test('align_content_stretch_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); }); test('align_content_stretch_row_with_children', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0.insertChild(root_child0_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); }); test('align_content_stretch_row_with_flex', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setFlexGrow(1); root_child3.setFlexShrink(1); root_child3.setFlexBasis("0%"); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(0); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(100); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(0); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(100); }); test('align_content_stretch_row_with_flex_no_shrink', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setFlexGrow(1); root_child3.setFlexBasis("0%"); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(0); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(100); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(0); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(100); }); test('align_content_stretch_row_with_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setMargin(Edge.All, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setMargin(Edge.All, 10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(40); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(40); expect(root_child3.getComputedLeft()).toBe(60); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(40); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(40); expect(root_child3.getComputedLeft()).toBe(40); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(100); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(20); }); test('align_content_stretch_row_with_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setPadding(Edge.All, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setPadding(Edge.All, 10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); }); test('align_content_stretch_row_with_single_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); }); test('align_content_stretch_row_with_fixed_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(60); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(80); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(60); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(80); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(80); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(60); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(80); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(20); }); test('align_content_stretch_row_with_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setMaxHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(50); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(50); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); }); test('align_content_stretch_row_with_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setMinHeight(80); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(90); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(90); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(90); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(90); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(90); expect(root_child3.getComputedLeft()).toBe(100); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(10); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(90); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(10); }); test('align_content_stretch_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(150); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0.insertChild(root_child0_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(50); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(50); expect(root_child4.getComputedHeight()).toBe(50); }); test('align_content_stretch_is_not_overriding_align_items', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setAlignItems(Align.Center); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setAlignContent(Align.Stretch); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(10); root_child0_child0.setWidth(10); root_child0_child0.setAlignContent(Align.Stretch); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(45); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(45); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); }); test('align_content_stretch_with_min_cross_axis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMinHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(250); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(250); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_stretch_with_max_cross_axis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMaxHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_stretch_with_max_cross_axis_and_border_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMaxHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); root.setBorder(Edge.All, 5); root.setPadding(Edge.All, 2); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(414); expect(root_child0.getComputedLeft()).toBe(7); expect(root_child0.getComputedTop()).toBe(7); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(7); expect(root_child1.getComputedTop()).toBe(207); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(414); expect(root_child0.getComputedLeft()).toBe(93); expect(root_child0.getComputedTop()).toBe(7); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(93); expect(root_child1.getComputedTop()).toBe(207); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_space_evenly_with_min_cross_axis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMinHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(33); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(267); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(33); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(267); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_space_evenly_with_max_cross_axis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMaxHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_space_evenly_with_max_cross_axis_violated', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMaxHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_space_evenly_with_max_cross_axis_violated_padding_and_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMaxHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceEvenly); root.setBorder(Edge.All, 5); root.setPadding(Edge.All, 2); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(7); expect(root_child0.getComputedTop()).toBe(7); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(7); expect(root_child1.getComputedTop()).toBe(207); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(93); expect(root_child0.getComputedTop()).toBe(7); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(93); expect(root_child1.getComputedTop()).toBe(207); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('align_content_space_around_and_align_items_flex_end_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceAround); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(88); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(88); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_space_around_and_align_items_center_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceAround); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(63); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(63); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_space_around_and_align_items_flex_start_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceAround); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(38); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(38); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_flex_start_stretch_doesnt_influence_line_box_dim', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(400); root.setFlexDirection(FlexDirection.Row); root.setPadding(Edge.Top, 20); root.setPadding(Edge.Bottom, 20); root.setPadding(Edge.Left, 20); root.setPadding(Edge.Right, 20); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setMargin(Edge.Right, 20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(FlexDirection.Row); root_child1.setFlexWrap(Wrap.Wrap); root_child1.setFlexShrink(1); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setHeight(30); root_child1_child0.setWidth(30); root_child1_child0.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setHeight(30); root_child1_child1.setWidth(30); root_child1_child1.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child1, 1); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setHeight(30); root_child1_child2.setWidth(30); root_child1_child2.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child2, 2); const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setHeight(30); root_child1_child3.setWidth(30); root_child1_child3.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child3, 3); const root_child1_child4 = Yoga.Node.create(config); root_child1_child4.setHeight(30); root_child1_child4.setWidth(30); root_child1_child4.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child4, 4); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(50); root_child2.setMargin(Edge.Left, 20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(140); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(170); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(30); expect(root_child1_child0.getComputedHeight()).toBe(30); expect(root_child1_child1.getComputedLeft()).toBe(50); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(30); expect(root_child1_child1.getComputedHeight()).toBe(30); expect(root_child1_child2.getComputedLeft()).toBe(100); expect(root_child1_child2.getComputedTop()).toBe(0); expect(root_child1_child2.getComputedWidth()).toBe(30); expect(root_child1_child2.getComputedHeight()).toBe(30); expect(root_child1_child3.getComputedLeft()).toBe(0); expect(root_child1_child3.getComputedTop()).toBe(30); expect(root_child1_child3.getComputedWidth()).toBe(30); expect(root_child1_child3.getComputedHeight()).toBe(30); expect(root_child1_child4.getComputedLeft()).toBe(50); expect(root_child1_child4.getComputedTop()).toBe(30); expect(root_child1_child4.getComputedWidth()).toBe(30); expect(root_child1_child4.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(330); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(260); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(170); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(120); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(30); expect(root_child1_child0.getComputedHeight()).toBe(30); expect(root_child1_child1.getComputedLeft()).toBe(70); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(30); expect(root_child1_child1.getComputedHeight()).toBe(30); expect(root_child1_child2.getComputedLeft()).toBe(20); expect(root_child1_child2.getComputedTop()).toBe(0); expect(root_child1_child2.getComputedWidth()).toBe(30); expect(root_child1_child2.getComputedHeight()).toBe(30); expect(root_child1_child3.getComputedLeft()).toBe(120); expect(root_child1_child3.getComputedTop()).toBe(30); expect(root_child1_child3.getComputedWidth()).toBe(30); expect(root_child1_child3.getComputedHeight()).toBe(30); expect(root_child1_child4.getComputedLeft()).toBe(70); expect(root_child1_child4.getComputedTop()).toBe(30); expect(root_child1_child4.getComputedWidth()).toBe(30); expect(root_child1_child4.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_stretch_stretch_does_influence_line_box_dim', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(400); root.setFlexDirection(FlexDirection.Row); root.setPadding(Edge.Top, 20); root.setPadding(Edge.Bottom, 20); root.setPadding(Edge.Left, 20); root.setPadding(Edge.Right, 20); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setMargin(Edge.Right, 20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(FlexDirection.Row); root_child1.setFlexWrap(Wrap.Wrap); root_child1.setFlexShrink(1); root_child1.setFlexGrow(1); root_child1.setAlignContent(Align.Stretch); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setHeight(30); root_child1_child0.setWidth(30); root_child1_child0.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setHeight(30); root_child1_child1.setWidth(30); root_child1_child1.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child1, 1); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setHeight(30); root_child1_child2.setWidth(30); root_child1_child2.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child2, 2); const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setHeight(30); root_child1_child3.setWidth(30); root_child1_child3.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child3, 3); const root_child1_child4 = Yoga.Node.create(config); root_child1_child4.setHeight(30); root_child1_child4.setWidth(30); root_child1_child4.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child4, 4); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(50); root_child2.setMargin(Edge.Left, 20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(140); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(170); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(30); expect(root_child1_child0.getComputedHeight()).toBe(30); expect(root_child1_child1.getComputedLeft()).toBe(50); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(30); expect(root_child1_child1.getComputedHeight()).toBe(30); expect(root_child1_child2.getComputedLeft()).toBe(100); expect(root_child1_child2.getComputedTop()).toBe(0); expect(root_child1_child2.getComputedWidth()).toBe(30); expect(root_child1_child2.getComputedHeight()).toBe(30); expect(root_child1_child3.getComputedLeft()).toBe(0); expect(root_child1_child3.getComputedTop()).toBe(50); expect(root_child1_child3.getComputedWidth()).toBe(30); expect(root_child1_child3.getComputedHeight()).toBe(30); expect(root_child1_child4.getComputedLeft()).toBe(50); expect(root_child1_child4.getComputedTop()).toBe(50); expect(root_child1_child4.getComputedWidth()).toBe(30); expect(root_child1_child4.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(330); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(260); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(170); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(120); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(30); expect(root_child1_child0.getComputedHeight()).toBe(30); expect(root_child1_child1.getComputedLeft()).toBe(70); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(30); expect(root_child1_child1.getComputedHeight()).toBe(30); expect(root_child1_child2.getComputedLeft()).toBe(20); expect(root_child1_child2.getComputedTop()).toBe(0); expect(root_child1_child2.getComputedWidth()).toBe(30); expect(root_child1_child2.getComputedHeight()).toBe(30); expect(root_child1_child3.getComputedLeft()).toBe(120); expect(root_child1_child3.getComputedTop()).toBe(50); expect(root_child1_child3.getComputedWidth()).toBe(30); expect(root_child1_child3.getComputedHeight()).toBe(30); expect(root_child1_child4.getComputedLeft()).toBe(70); expect(root_child1_child4.getComputedTop()).toBe(50); expect(root_child1_child4.getComputedWidth()).toBe(30); expect(root_child1_child4.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_space_evenly_stretch_does_influence_line_box_dim', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(400); root.setFlexDirection(FlexDirection.Row); root.setPadding(Edge.Top, 20); root.setPadding(Edge.Bottom, 20); root.setPadding(Edge.Left, 20); root.setPadding(Edge.Right, 20); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setMargin(Edge.Right, 20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(FlexDirection.Row); root_child1.setFlexWrap(Wrap.Wrap); root_child1.setFlexShrink(1); root_child1.setFlexGrow(1); root_child1.setAlignContent(Align.Stretch); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setHeight(30); root_child1_child0.setWidth(30); root_child1_child0.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setHeight(30); root_child1_child1.setWidth(30); root_child1_child1.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child1, 1); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setHeight(30); root_child1_child2.setWidth(30); root_child1_child2.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child2, 2); const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setHeight(30); root_child1_child3.setWidth(30); root_child1_child3.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child3, 3); const root_child1_child4 = Yoga.Node.create(config); root_child1_child4.setHeight(30); root_child1_child4.setWidth(30); root_child1_child4.setMargin(Edge.Right, 20); root_child1.insertChild(root_child1_child4, 4); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(50); root_child2.setMargin(Edge.Left, 20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(140); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(170); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(30); expect(root_child1_child0.getComputedHeight()).toBe(30); expect(root_child1_child1.getComputedLeft()).toBe(50); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(30); expect(root_child1_child1.getComputedHeight()).toBe(30); expect(root_child1_child2.getComputedLeft()).toBe(100); expect(root_child1_child2.getComputedTop()).toBe(0); expect(root_child1_child2.getComputedWidth()).toBe(30); expect(root_child1_child2.getComputedHeight()).toBe(30); expect(root_child1_child3.getComputedLeft()).toBe(0); expect(root_child1_child3.getComputedTop()).toBe(50); expect(root_child1_child3.getComputedWidth()).toBe(30); expect(root_child1_child3.getComputedHeight()).toBe(30); expect(root_child1_child4.getComputedLeft()).toBe(50); expect(root_child1_child4.getComputedTop()).toBe(50); expect(root_child1_child4.getComputedWidth()).toBe(30); expect(root_child1_child4.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(330); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(260); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(170); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(120); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(30); expect(root_child1_child0.getComputedHeight()).toBe(30); expect(root_child1_child1.getComputedLeft()).toBe(70); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(30); expect(root_child1_child1.getComputedHeight()).toBe(30); expect(root_child1_child2.getComputedLeft()).toBe(20); expect(root_child1_child2.getComputedTop()).toBe(0); expect(root_child1_child2.getComputedWidth()).toBe(30); expect(root_child1_child2.getComputedHeight()).toBe(30); expect(root_child1_child3.getComputedLeft()).toBe(120); expect(root_child1_child3.getComputedTop()).toBe(50); expect(root_child1_child3.getComputedWidth()).toBe(30); expect(root_child1_child3.getComputedHeight()).toBe(30); expect(root_child1_child4.getComputedLeft()).toBe(70); expect(root_child1_child4.getComputedTop()).toBe(50); expect(root_child1_child4.getComputedWidth()).toBe(30); expect(root_child1_child4.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_stretch_and_align_items_flex_end_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root_child0.setAlignSelf(Align.FlexStart); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(250); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(250); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_stretch_and_align_items_flex_start_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(125); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(175); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(125); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(175); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_stretch_and_align_items_center_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(125); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(125); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(38); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); test('align_content_stretch_and_align_items_stretch_with_flex_wrap', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth(150); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root_child1.setWidth(120); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root_child2.setWidth(120); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(125); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(175); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(125); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(120); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(175); expect(root_child2.getComputedWidth()).toBe(120); expect(root_child2.getComputedHeight()).toBe(50); }); ================================================ FILE: javascript/tests/generated/YGAlignItemsTest.test.ts ================================================ /** * 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<<4caffe8672815f4626915cf6476376e9>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAlignItemsTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('align_items_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_items_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_items_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_items_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_baseline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); }); test('align_baseline_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); }); test('align_baseline_child_multiline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(60); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(25); root_child1.setFlexWrap(Wrap.Wrap); root_child1.setFlexDirection(FlexDirection.Row); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(25); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setWidth(25); root_child1_child1.setHeight(10); root_child1.insertChild(root_child1_child1, 1); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth(25); root_child1_child2.setHeight(20); root_child1.insertChild(root_child1_child2, 2); const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setWidth(25); root_child1_child3.setHeight(10); root_child1.insertChild(root_child1_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child1_child1.getComputedLeft()).toBe(25); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(10); expect(root_child1_child2.getComputedLeft()).toBe(0); expect(root_child1_child2.getComputedTop()).toBe(20); expect(root_child1_child2.getComputedWidth()).toBe(25); expect(root_child1_child2.getComputedHeight()).toBe(20); expect(root_child1_child3.getComputedLeft()).toBe(25); expect(root_child1_child3.getComputedTop()).toBe(20); expect(root_child1_child3.getComputedWidth()).toBe(25); expect(root_child1_child3.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child1_child0.getComputedLeft()).toBe(25); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child1_child1.getComputedLeft()).toBe(0); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(10); expect(root_child1_child2.getComputedLeft()).toBe(25); expect(root_child1_child2.getComputedTop()).toBe(20); expect(root_child1_child2.getComputedWidth()).toBe(25); expect(root_child1_child2.getComputedHeight()).toBe(20); expect(root_child1_child3.getComputedLeft()).toBe(0); expect(root_child1_child3.getComputedTop()).toBe(20); expect(root_child1_child3.getComputedWidth()).toBe(25); expect(root_child1_child3.getComputedHeight()).toBe(10); }); test('align_baseline_child_multiline_override', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(60); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(25); root_child1.setFlexWrap(Wrap.Wrap); root_child1.setFlexDirection(FlexDirection.Row); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(25); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setWidth(25); root_child1_child1.setHeight(10); root_child1_child1.setAlignSelf(Align.Baseline); root_child1.insertChild(root_child1_child1, 1); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth(25); root_child1_child2.setHeight(20); root_child1.insertChild(root_child1_child2, 2); const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setWidth(25); root_child1_child3.setHeight(10); root_child1_child3.setAlignSelf(Align.Baseline); root_child1.insertChild(root_child1_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child1_child1.getComputedLeft()).toBe(25); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(10); expect(root_child1_child2.getComputedLeft()).toBe(0); expect(root_child1_child2.getComputedTop()).toBe(20); expect(root_child1_child2.getComputedWidth()).toBe(25); expect(root_child1_child2.getComputedHeight()).toBe(20); expect(root_child1_child3.getComputedLeft()).toBe(25); expect(root_child1_child3.getComputedTop()).toBe(20); expect(root_child1_child3.getComputedWidth()).toBe(25); expect(root_child1_child3.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child1_child0.getComputedLeft()).toBe(25); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child1_child1.getComputedLeft()).toBe(0); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(10); expect(root_child1_child2.getComputedLeft()).toBe(25); expect(root_child1_child2.getComputedTop()).toBe(20); expect(root_child1_child2.getComputedWidth()).toBe(25); expect(root_child1_child2.getComputedHeight()).toBe(20); expect(root_child1_child3.getComputedLeft()).toBe(0); expect(root_child1_child3.getComputedTop()).toBe(20); expect(root_child1_child3.getComputedWidth()).toBe(25); expect(root_child1_child3.getComputedHeight()).toBe(10); }); test('align_baseline_child_multiline_no_override_on_secondline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(60); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(25); root_child1.setFlexWrap(Wrap.Wrap); root_child1.setFlexDirection(FlexDirection.Row); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(25); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setWidth(25); root_child1_child1.setHeight(10); root_child1.insertChild(root_child1_child1, 1); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth(25); root_child1_child2.setHeight(20); root_child1.insertChild(root_child1_child2, 2); const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setWidth(25); root_child1_child3.setHeight(10); root_child1_child3.setAlignSelf(Align.Baseline); root_child1.insertChild(root_child1_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child1_child1.getComputedLeft()).toBe(25); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(10); expect(root_child1_child2.getComputedLeft()).toBe(0); expect(root_child1_child2.getComputedTop()).toBe(20); expect(root_child1_child2.getComputedWidth()).toBe(25); expect(root_child1_child2.getComputedHeight()).toBe(20); expect(root_child1_child3.getComputedLeft()).toBe(25); expect(root_child1_child3.getComputedTop()).toBe(20); expect(root_child1_child3.getComputedWidth()).toBe(25); expect(root_child1_child3.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child1_child0.getComputedLeft()).toBe(25); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child1_child1.getComputedLeft()).toBe(0); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(10); expect(root_child1_child2.getComputedLeft()).toBe(25); expect(root_child1_child2.getComputedTop()).toBe(20); expect(root_child1_child2.getComputedWidth()).toBe(25); expect(root_child1_child2.getComputedHeight()).toBe(20); expect(root_child1_child3.getComputedLeft()).toBe(0); expect(root_child1_child3.getComputedTop()).toBe(20); expect(root_child1_child3.getComputedWidth()).toBe(25); expect(root_child1_child3.getComputedHeight()).toBe(10); }); test('align_baseline_child_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setPosition(Edge.Top, 10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); }); test('align_baseline_child_top2', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root_child1.setPosition(Edge.Top, 5); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(45); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(45); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); }); test('align_baseline_double_nested_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(15); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(5); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(15); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(5); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(15); }); test('align_baseline_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); }); test('align_baseline_child_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.All, 5); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1_child0.setMargin(Edge.All, 1); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(44); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(1); expect(root_child1_child0.getComputedTop()).toBe(1); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(-10); expect(root_child1.getComputedTop()).toBe(44); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(-1); expect(root_child1_child0.getComputedTop()).toBe(1); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); }); test('align_baseline_child_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root_child1.setPadding(Edge.All, 5); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(55); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(5); expect(root_child1_child0.getComputedTop()).toBe(5); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(-5); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(-5); expect(root_child1_child0.getComputedTop()).toBe(5); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); }); test('align_baseline_multiline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(50); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(50); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child2_child0.getComputedLeft()).toBe(0); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(50); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(60); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child2_child0.getComputedLeft()).toBe(0); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(50); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(60); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(50); }); test.skip('align_baseline_multiline_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.Baseline); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(20); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root_child2.setHeight(70); root.insertChild(root_child2, 2); const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(10); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(20); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(70); expect(root_child2_child0.getComputedLeft()).toBe(0); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(10); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(70); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child1_child0.getComputedLeft()).toBe(10); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(20); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(70); expect(root_child2_child0.getComputedLeft()).toBe(30); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(10); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(70); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); }); test.skip('align_baseline_multiline_column2', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.Baseline); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(20); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root_child2.setHeight(70); root.insertChild(root_child2, 2); const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(10); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(20); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(70); expect(root_child2_child0.getComputedLeft()).toBe(0); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(10); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(70); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child1_child0.getComputedLeft()).toBe(10); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(20); expect(root_child1_child0.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(70); expect(root_child2_child0.getComputedLeft()).toBe(30); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(10); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(70); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); }); test('align_baseline_multiline_row_and_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Baseline); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(50); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child2_child0.getComputedLeft()).toBe(0); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(50); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(50); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child2_child0.getComputedLeft()).toBe(0); expect(root_child2_child0.getComputedTop()).toBe(0); expect(root_child2_child0.getComputedWidth()).toBe(50); expect(root_child2_child0.getComputedHeight()).toBe(10); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(50); expect(root_child3.getComputedHeight()).toBe(20); }); test('align_items_center_child_with_margin_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Align.Center); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(52); root_child0_child0.setHeight(52); root_child0_child0.setMargin(Edge.Left, 10); root_child0_child0.setMargin(Edge.Right, 10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(52); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(52); expect(root_child0_child0.getComputedHeight()).toBe(52); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(52); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(52); expect(root_child0_child0.getComputedHeight()).toBe(52); }); test('align_items_flex_end_child_with_margin_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Align.FlexEnd); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(52); root_child0_child0.setHeight(52); root_child0_child0.setMargin(Edge.Left, 10); root_child0_child0.setMargin(Edge.Right, 10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(52); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(52); expect(root_child0_child0.getComputedHeight()).toBe(52); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(52); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(52); expect(root_child0_child0.getComputedHeight()).toBe(52); }); test('align_items_center_child_without_margin_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Align.Center); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(72); root_child0_child0.setHeight(72); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0.getComputedHeight()).toBe(72); }); test('align_items_flex_end_child_without_margin_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Align.FlexEnd); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(72); root_child0_child0.setHeight(72); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0.getComputedHeight()).toBe(72); }); test('align_center_should_size_based_on_content', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.Center); root.setMargin(Edge.Top, 20); const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setJustifyContent(Justify.Center); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(20); root_child0_child0_child0.setHeight(20); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(20); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(20); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(20); }); test('align_stretch_should_size_based_on_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setMargin(Edge.Top, 20); const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setJustifyContent(Justify.Center); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(20); root_child0_child0_child0.setHeight(20); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(20); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(20); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(20); expect(root_child0_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(20); }); test('align_flex_start_with_shrinking_children', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Align.FlexStart); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(500); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0.getComputedHeight()).toBe(0); }); test('align_flex_start_with_stretching_children', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0_child0.getComputedHeight()).toBe(0); }); test('align_flex_start_with_shrinking_children_with_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Align.FlexStart); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(500); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0.getComputedHeight()).toBe(0); }); test('align_flex_end_with_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(75); root.setAlignItems(Align.FlexEnd); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Right, 5); root_child0.setMargin(Edge.Left, 3); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(75); expect(root_child0.getComputedLeft()).toBe(3); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(58); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(75); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(-8); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('align_stretch_with_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(75); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Right, 5); root_child0.setMargin(Edge.Left, 3); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(75); expect(root_child0.getComputedLeft()).toBe(3); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(58); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(75); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(-8); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('align_items_non_stretch_s526008', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(400); root.setHeight(400); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setAlignItems(Align.FlexStart); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(0); root_child0_child0_child0_child0.setHeight(10); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(400); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(10); }); ================================================ FILE: javascript/tests/generated/YGAlignSelfTest.test.ts ================================================ /** * 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<<314a0b8edb3f8e12937a84996c8b1d18>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAlignSelfTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('align_self_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root_child0.setAlignSelf(Align.Center); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_self_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_self_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root_child0.setAlignSelf(Align.FlexStart); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_self_flex_end_override_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root_child0.setAlignSelf(Align.FlexEnd); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('align_self_baseline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setAlignSelf(Align.Baseline); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root_child1.setAlignSelf(Align.Baseline); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(50); expect(root_child1_child0.getComputedHeight()).toBe(10); }); ================================================ FILE: javascript/tests/generated/YGAndroidNewsFeed.test.ts ================================================ /** * 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<<1e82044495185ac27a199c4794c2ebca>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAndroidNewsFeed.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('android_news_feed', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setAlignContent(Align.Stretch); root.setWidth(1080); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setAlignContent(Align.Stretch); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0_child0_child0.setAlignItems(Align.FlexStart); root_child0_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child0_child0.setMargin(Edge.Top, 24); root_child0_child0_child0_child0.setMargin(Edge.Start, 36); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0, 0); const root_child0_child0_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child0_child0_child0_child0.setWidth(120); root_child0_child0_child0_child0_child0_child0.setHeight(120); root_child0_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0_child0, 0); const root_child0_child0_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child0_child0_child1.setAlignContent(Align.Stretch); root_child0_child0_child0_child0_child1.setFlexShrink(1); root_child0_child0_child0_child0_child1.setMargin(Edge.Right, 36); root_child0_child0_child0_child0_child1.setPadding(Edge.Left, 36); root_child0_child0_child0_child0_child1.setPadding(Edge.Top, 21); root_child0_child0_child0_child0_child1.setPadding(Edge.Right, 36); root_child0_child0_child0_child0_child1.setPadding(Edge.Bottom, 18); root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child1, 1); const root_child0_child0_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child1_child0.setFlexDirection(FlexDirection.Row); root_child0_child0_child0_child0_child1_child0.setAlignContent(Align.Stretch); root_child0_child0_child0_child0_child1_child0.setFlexShrink(1); root_child0_child0_child0_child0_child1.insertChild(root_child0_child0_child0_child0_child1_child0, 0); const root_child0_child0_child0_child0_child1_child1 = Yoga.Node.create(config); root_child0_child0_child0_child0_child1_child1.setAlignContent(Align.Stretch); root_child0_child0_child0_child0_child1_child1.setFlexShrink(1); root_child0_child0_child0_child0_child1.insertChild(root_child0_child0_child0_child0_child1_child1, 1); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setAlignContent(Align.Stretch); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setFlexDirection(FlexDirection.Row); root_child0_child0_child1_child0.setAlignItems(Align.FlexStart); root_child0_child0_child1_child0.setAlignContent(Align.Stretch); root_child0_child0_child1_child0.setMargin(Edge.Top, 24); root_child0_child0_child1_child0.setMargin(Edge.Start, 174); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child1_child0_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0_child1_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child1_child0.insertChild(root_child0_child0_child1_child0_child0, 0); const root_child0_child0_child1_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child1_child0_child0_child0.setWidth(72); root_child0_child0_child1_child0_child0_child0.setHeight(72); root_child0_child0_child1_child0_child0.insertChild(root_child0_child0_child1_child0_child0_child0, 0); const root_child0_child0_child1_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1_child0_child1.setAlignContent(Align.Stretch); root_child0_child0_child1_child0_child1.setFlexShrink(1); root_child0_child0_child1_child0_child1.setMargin(Edge.Right, 36); root_child0_child0_child1_child0_child1.setPadding(Edge.Left, 36); root_child0_child0_child1_child0_child1.setPadding(Edge.Top, 21); root_child0_child0_child1_child0_child1.setPadding(Edge.Right, 36); root_child0_child0_child1_child0_child1.setPadding(Edge.Bottom, 18); root_child0_child0_child1_child0.insertChild(root_child0_child0_child1_child0_child1, 1); const root_child0_child0_child1_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0_child1_child0.setFlexDirection(FlexDirection.Row); root_child0_child0_child1_child0_child1_child0.setAlignContent(Align.Stretch); root_child0_child0_child1_child0_child1_child0.setFlexShrink(1); root_child0_child0_child1_child0_child1.insertChild(root_child0_child0_child1_child0_child1_child0, 0); const root_child0_child0_child1_child0_child1_child1 = Yoga.Node.create(config); root_child0_child0_child1_child0_child1_child1.setAlignContent(Align.Stretch); root_child0_child0_child1_child0_child1_child1.setFlexShrink(1); root_child0_child0_child1_child0_child1.insertChild(root_child0_child0_child1_child0_child1_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(1080); expect(root.getComputedHeight()).toBe(240); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1080); expect(root_child0.getComputedHeight()).toBe(240); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1080); expect(root_child0_child0.getComputedHeight()).toBe(240); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(1080); expect(root_child0_child0_child0.getComputedHeight()).toBe(144); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(36); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(24); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(1044); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(120); expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); expect(root_child0_child0_child0_child0_child1.getComputedLeft()).toBe(120); expect(root_child0_child0_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child1.getComputedWidth()).toBe(72); expect(root_child0_child0_child0_child0_child1.getComputedHeight()).toBe(39); expect(root_child0_child0_child0_child0_child1_child0.getComputedLeft()).toBe(36); expect(root_child0_child0_child0_child0_child1_child0.getComputedTop()).toBe(21); expect(root_child0_child0_child0_child0_child1_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0_child0_child1_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0_child0_child1_child1.getComputedLeft()).toBe(36); expect(root_child0_child0_child0_child0_child1_child1.getComputedTop()).toBe(21); expect(root_child0_child0_child0_child0_child1_child1.getComputedWidth()).toBe(0); expect(root_child0_child0_child0_child0_child1_child1.getComputedHeight()).toBe(0); expect(root_child0_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child1.getComputedTop()).toBe(144); expect(root_child0_child0_child1.getComputedWidth()).toBe(1080); expect(root_child0_child0_child1.getComputedHeight()).toBe(96); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(174); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(24); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(906); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(72); expect(root_child0_child0_child1_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child1_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child1_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0_child1_child0_child0.getComputedHeight()).toBe(72); expect(root_child0_child0_child1_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child1_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child1_child0_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0_child1_child0_child0_child0.getComputedHeight()).toBe(72); expect(root_child0_child0_child1_child0_child1.getComputedLeft()).toBe(72); expect(root_child0_child0_child1_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1_child0_child1.getComputedWidth()).toBe(72); expect(root_child0_child0_child1_child0_child1.getComputedHeight()).toBe(39); expect(root_child0_child0_child1_child0_child1_child0.getComputedLeft()).toBe(36); expect(root_child0_child0_child1_child0_child1_child0.getComputedTop()).toBe(21); expect(root_child0_child0_child1_child0_child1_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child1_child0_child1_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child1_child0_child1_child1.getComputedLeft()).toBe(36); expect(root_child0_child0_child1_child0_child1_child1.getComputedTop()).toBe(21); expect(root_child0_child0_child1_child0_child1_child1.getComputedWidth()).toBe(0); expect(root_child0_child0_child1_child0_child1_child1.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(1080); expect(root.getComputedHeight()).toBe(240); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1080); expect(root_child0.getComputedHeight()).toBe(240); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1080); expect(root_child0_child0.getComputedHeight()).toBe(240); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(1080); expect(root_child0_child0_child0.getComputedHeight()).toBe(144); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(24); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(1044); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(120); expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(924); expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); expect(root_child0_child0_child0_child0_child1.getComputedLeft()).toBe(816); expect(root_child0_child0_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child1.getComputedWidth()).toBe(72); expect(root_child0_child0_child0_child0_child1.getComputedHeight()).toBe(39); expect(root_child0_child0_child0_child0_child1_child0.getComputedLeft()).toBe(36); expect(root_child0_child0_child0_child0_child1_child0.getComputedTop()).toBe(21); expect(root_child0_child0_child0_child0_child1_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child0_child0_child1_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0_child0_child1_child1.getComputedLeft()).toBe(36); expect(root_child0_child0_child0_child0_child1_child1.getComputedTop()).toBe(21); expect(root_child0_child0_child0_child0_child1_child1.getComputedWidth()).toBe(0); expect(root_child0_child0_child0_child0_child1_child1.getComputedHeight()).toBe(0); expect(root_child0_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child1.getComputedTop()).toBe(144); expect(root_child0_child0_child1.getComputedWidth()).toBe(1080); expect(root_child0_child0_child1.getComputedHeight()).toBe(96); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(24); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(906); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(72); expect(root_child0_child0_child1_child0_child0.getComputedLeft()).toBe(834); expect(root_child0_child0_child1_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child1_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0_child1_child0_child0.getComputedHeight()).toBe(72); expect(root_child0_child0_child1_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child1_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child1_child0_child0_child0.getComputedWidth()).toBe(72); expect(root_child0_child0_child1_child0_child0_child0.getComputedHeight()).toBe(72); expect(root_child0_child0_child1_child0_child1.getComputedLeft()).toBe(726); expect(root_child0_child0_child1_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1_child0_child1.getComputedWidth()).toBe(72); expect(root_child0_child0_child1_child0_child1.getComputedHeight()).toBe(39); expect(root_child0_child0_child1_child0_child1_child0.getComputedLeft()).toBe(36); expect(root_child0_child0_child1_child0_child1_child0.getComputedTop()).toBe(21); expect(root_child0_child0_child1_child0_child1_child0.getComputedWidth()).toBe(0); expect(root_child0_child0_child1_child0_child1_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child1_child0_child1_child1.getComputedLeft()).toBe(36); expect(root_child0_child0_child1_child0_child1_child1.getComputedTop()).toBe(21); expect(root_child0_child0_child1_child0_child1_child1.getComputedWidth()).toBe(0); expect(root_child0_child0_child1_child0_child1_child1.getComputedHeight()).toBe(0); }); ================================================ FILE: javascript/tests/generated/YGAspectRatioTest.test.ts ================================================ /** * 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<<30f135a4788f0c5ef1d65a2d893d394d>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAspectRatioTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test.skip('aspect_ratio_does_not_stretch_cross_axis_dim', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setOverflow(Overflow.Scroll); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(2); root_child0_child0_child0.setFlexShrink(1); root_child0_child0_child0.setFlexBasis("0%"); root_child0_child0_child0.setAspectRatio(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth(5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setFlexGrow(1); root_child0_child0_child2.setFlexShrink(1); root_child0_child0_child2.setFlexBasis("0%"); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setFlexGrow(1); root_child0_child0_child2_child0.setFlexShrink(1); root_child0_child0_child2_child0.setFlexBasis("0%"); root_child0_child0_child2_child0.setAspectRatio(1); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); const root_child0_child0_child2_child0_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0_child0.setWidth(5); root_child0_child0_child2_child0.insertChild(root_child0_child0_child2_child0_child0, 0); const root_child0_child0_child2_child0_child1 = Yoga.Node.create(config); root_child0_child0_child2_child0_child1.setFlexGrow(1); root_child0_child0_child2_child0_child1.setFlexShrink(1); root_child0_child0_child2_child0_child1.setFlexBasis("0%"); root_child0_child0_child2_child0_child1.setAspectRatio(1); root_child0_child0_child2_child0.insertChild(root_child0_child0_child2_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(300); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(300); expect(root_child0_child0.getComputedHeight()).toBe(197); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(197); expect(root_child0_child0_child0.getComputedHeight()).toBe(197); expect(root_child0_child0_child1.getComputedLeft()).toBe(197); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(5); expect(root_child0_child0_child1.getComputedHeight()).toBe(197); expect(root_child0_child0_child2.getComputedLeft()).toBe(202); expect(root_child0_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child0_child2.getComputedWidth()).toBe(98); expect(root_child0_child0_child2.getComputedHeight()).toBe(197); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(98); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(197); expect(root_child0_child0_child2_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0_child0.getComputedWidth()).toBe(5); expect(root_child0_child0_child2_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedWidth()).toBe(98); expect(root_child0_child0_child2_child0_child1.getComputedHeight()).toBe(197); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(300); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(300); expect(root_child0_child0.getComputedHeight()).toBe(197); expect(root_child0_child0_child0.getComputedLeft()).toBe(103); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(197); expect(root_child0_child0_child0.getComputedHeight()).toBe(197); expect(root_child0_child0_child1.getComputedLeft()).toBe(98); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(5); expect(root_child0_child0_child1.getComputedHeight()).toBe(197); expect(root_child0_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child0_child2.getComputedWidth()).toBe(98); expect(root_child0_child0_child2.getComputedHeight()).toBe(197); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(98); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(197); expect(root_child0_child0_child2_child0_child0.getComputedLeft()).toBe(93); expect(root_child0_child0_child2_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0_child0.getComputedWidth()).toBe(5); expect(root_child0_child0_child2_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child2_child0_child1.getComputedWidth()).toBe(98); expect(root_child0_child0_child2_child0_child1.getComputedHeight()).toBe(197); }); test('zero_aspect_ratio_behaves_like_auto', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(300); const root_child0 = Yoga.Node.create(config); root_child0.setAspectRatio(0); root_child0.setWidth(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(250); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); }); ================================================ FILE: javascript/tests/generated/YGAutoTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAutoTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('auto_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth("auto"); root.setHeight(50); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('auto_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(50); root.setHeight("auto"); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('auto_flex_basis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(50); root.setFlexBasis("auto"); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('auto_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(50); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(25); root_child0.setHeight(25); root_child0.setPositionAuto(Edge.Right); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); }); test('auto_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(50); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(25); root_child0.setHeight(25); root_child0.setMargin(Edge.Left, "auto"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); }); ================================================ FILE: javascript/tests/generated/YGBorderTest.test.ts ================================================ /** * 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<<0c7aeb1cb422285964264440e136da96>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGBorderTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('border_no_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setBorder(Edge.All, 10); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(20); }); test('border_container_match_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setBorder(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('border_flex_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(80); }); test('border_stretch_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(10); }); test('border_center_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.Start, 10); root.setBorder(Edge.End, 20); root.setBorder(Edge.Bottom, 20); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(35); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(35); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); ================================================ FILE: javascript/tests/generated/YGBoxSizingTest.test.ts ================================================ /** * 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<<46ef03a01883dfbdb5a69e6f2ff682ee>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGBoxSizingTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('box_sizing_content_box_simple', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.setBorder(Edge.All, 10); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(130); expect(root.getComputedHeight()).toBe(130); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(130); expect(root.getComputedHeight()).toBe(130); }); test('box_sizing_border_box_simple', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.setBorder(Edge.All, 10); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_content_box_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight("25%"); root_child0.setPadding(Edge.All, 4); root_child0.setBorder(Edge.All, 16); root_child0.setBoxSizing(BoxSizing.ContentBox); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(65); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(65); }); test('box_sizing_border_box_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight("25%"); root_child0.setPadding(Edge.All, 4); root_child0.setBorder(Edge.All, 16); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); }); test('box_sizing_content_box_absolute', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("25%"); root_child0.setPadding(Edge.All, 12); root_child0.setBorder(Edge.All, 8); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(65); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(65); }); test('box_sizing_border_box_absolute', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("25%"); root_child0.setPadding(Edge.All, 12); root_child0.setBorder(Edge.All, 8); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(40); }); test('box_sizing_content_box_comtaining_block', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 12); root.setBorder(Edge.All, 8); root.setBoxSizing(BoxSizing.ContentBox); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Static); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight("25%"); root_child0_child0.setPositionType(PositionType.Absolute); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(31); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(140); expect(root.getComputedHeight()).toBe(140); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(31); }); test('box_sizing_border_box_comtaining_block', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 12); root.setBorder(Edge.All, 8); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Static); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight("25%"); root_child0_child0.setPositionType(PositionType.Absolute); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(21); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(21); }); test('box_sizing_content_box_padding_only', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(110); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(110); }); test('box_sizing_content_box_padding_only_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(150); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(75); root_child0.setPadding(Edge.All, "10%"); root_child0.setBoxSizing(BoxSizing.ContentBox); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(70); expect(root_child0.getComputedHeight()).toBe(95); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(70); expect(root_child0.getComputedHeight()).toBe(95); }); test('box_sizing_border_box_padding_only', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_padding_only_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(150); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(75); root_child0.setPadding(Edge.All, "10%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(75); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(75); }); test('box_sizing_content_box_border_only', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.All, 10); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(120); expect(root.getComputedHeight()).toBe(120); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(120); expect(root.getComputedHeight()).toBe(120); }); test('box_sizing_content_box_border_only_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setBoxSizing(BoxSizing.ContentBox); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); }); test('box_sizing_border_box_border_only', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.All, 10); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_border_only_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); }); test('box_sizing_content_box_no_padding_no_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_no_padding_no_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_content_box_children', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.setBorder(Edge.All, 10); root.setBoxSizing(BoxSizing.ContentBox); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(25); root_child0.setHeight(25); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(25); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(25); root_child3.setHeight(25); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(130); expect(root.getComputedHeight()).toBe(130); expect(root_child0.getComputedLeft()).toBe(15); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(15); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(15); expect(root_child2.getComputedTop()).toBe(65); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(15); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(130); expect(root.getComputedHeight()).toBe(130); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(65); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(90); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); }); test('box_sizing_border_box_children', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 5); root.setBorder(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(25); root_child0.setHeight(25); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(25); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(25); root_child3.setHeight(25); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(15); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(15); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(15); expect(root_child2.getComputedTop()).toBe(65); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(15); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(65); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(60); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); }); test('box_sizing_content_box_siblings', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(25); root_child0.setHeight(25); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root_child1.setBoxSizing(BoxSizing.ContentBox); root_child1.setPadding(Edge.All, 10); root_child1.setBorder(Edge.All, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(25); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(25); root_child3.setHeight(25); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(25); expect(root_child1.getComputedWidth()).toBe(65); expect(root_child1.getComputedHeight()).toBe(65); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(90); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(115); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(35); expect(root_child1.getComputedTop()).toBe(25); expect(root_child1.getComputedWidth()).toBe(65); expect(root_child1.getComputedHeight()).toBe(65); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(90); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(75); expect(root_child3.getComputedTop()).toBe(115); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); }); test('box_sizing_border_box_siblings', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(25); root_child0.setHeight(25); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root_child1.setPadding(Edge.All, 10); root_child1.setBorder(Edge.All, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(25); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(25); root_child3.setHeight(25); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(25); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(40); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(65); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(25); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(25); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(40); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(65); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(25); expect(root_child3.getComputedLeft()).toBe(75); expect(root_child3.getComputedTop()).toBe(90); expect(root_child3.getComputedWidth()).toBe(25); expect(root_child3.getComputedHeight()).toBe(25); }); test('box_sizing_content_box_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth(50); root_child0.setHeight(25); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(65); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(65); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_border_box_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth(50); root_child0.setHeight(25); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_content_box_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setMaxHeight(50); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_border_box_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setMaxHeight(50); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_content_box_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth(50); root_child0.setHeight(25); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(65); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(65); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_border_box_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth(50); root_child0.setHeight(25); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_content_box_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setMinHeight(50); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(90); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(90); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_border_box_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setMinHeight(50); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 15); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(25); root_child1.setHeight(25); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(25); }); test('box_sizing_content_box_no_height_no_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 2); root_child0.setBorder(Edge.All, 7); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(18); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(18); }); test('box_sizing_border_box_no_height_no_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setPadding(Edge.All, 2); root_child0.setBorder(Edge.All, 7); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(18); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(18); }); test('box_sizing_content_box_nested', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBoxSizing(BoxSizing.ContentBox); root.setPadding(Edge.All, 15); root.setBorder(Edge.All, 3); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 2); root_child0.setBorder(Edge.All, 7); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(5); root_child0_child0.setBoxSizing(BoxSizing.ContentBox); root_child0_child0.setPadding(Edge.All, 1); root_child0_child0.setBorder(Edge.All, 2); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(136); expect(root.getComputedHeight()).toBe(136); expect(root_child0.getComputedLeft()).toBe(18); expect(root_child0.getComputedTop()).toBe(18); expect(root_child0.getComputedWidth()).toBe(38); expect(root_child0.getComputedHeight()).toBe(38); expect(root_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0.getComputedWidth()).toBe(16); expect(root_child0_child0.getComputedHeight()).toBe(11); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(136); expect(root.getComputedHeight()).toBe(136); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(18); expect(root_child0.getComputedWidth()).toBe(38); expect(root_child0.getComputedHeight()).toBe(38); expect(root_child0_child0.getComputedLeft()).toBe(13); expect(root_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0.getComputedWidth()).toBe(16); expect(root_child0_child0.getComputedHeight()).toBe(11); }); test('box_sizing_border_box_nested', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 15); root.setBorder(Edge.All, 3); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setPadding(Edge.All, 2); root_child0.setBorder(Edge.All, 7); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(5); root_child0_child0.setPadding(Edge.All, 1); root_child0_child0.setBorder(Edge.All, 2); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(18); expect(root_child0.getComputedTop()).toBe(18); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(6); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(62); expect(root_child0.getComputedTop()).toBe(18); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(1); expect(root_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(6); }); test('box_sizing_content_box_nested_alternating', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBoxSizing(BoxSizing.ContentBox); root.setPadding(Edge.All, 3); root.setBorder(Edge.All, 2); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root_child0.setHeight(40); root_child0.setPadding(Edge.All, 8); root_child0.setBorder(Edge.All, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(20); root_child0_child0.setHeight(25); root_child0_child0.setBoxSizing(BoxSizing.ContentBox); root_child0_child0.setPadding(Edge.All, 3); root_child0_child0.setBorder(Edge.All, 6); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(10); root_child0_child0_child0.setHeight(5); root_child0_child0_child0.setPadding(Edge.All, 1); root_child0_child0_child0.setBorder(Edge.All, 1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(110); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0.getComputedWidth()).toBe(38); expect(root_child0_child0.getComputedHeight()).toBe(43); expect(root_child0_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0_child0.getComputedHeight()).toBe(5); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(110); expect(root.getComputedHeight()).toBe(110); expect(root_child0.getComputedLeft()).toBe(65); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(40); expect(root_child0_child0.getComputedLeft()).toBe(-8); expect(root_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0.getComputedWidth()).toBe(38); expect(root_child0_child0.getComputedHeight()).toBe(43); expect(root_child0_child0_child0.getComputedLeft()).toBe(19); expect(root_child0_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0_child0.getComputedHeight()).toBe(5); }); test('box_sizing_border_box_nested_alternating', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 3); root.setBorder(Edge.All, 2); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root_child0.setHeight(40); root_child0.setBoxSizing(BoxSizing.ContentBox); root_child0.setPadding(Edge.All, 8); root_child0.setBorder(Edge.All, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(20); root_child0_child0.setHeight(25); root_child0_child0.setPadding(Edge.All, 3); root_child0_child0.setBorder(Edge.All, 6); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(10); root_child0_child0_child0.setHeight(5); root_child0_child0_child0.setBoxSizing(BoxSizing.ContentBox); root_child0_child0_child0.setPadding(Edge.All, 1); root_child0_child0_child0.setBorder(Edge.All, 1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(25); expect(root_child0_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0_child0.getComputedWidth()).toBe(14); expect(root_child0_child0_child0.getComputedHeight()).toBe(9); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(35); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child0_child0.getComputedLeft()).toBe(30); expect(root_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(25); expect(root_child0_child0_child0.getComputedLeft()).toBe(-3); expect(root_child0_child0_child0.getComputedTop()).toBe(9); expect(root_child0_child0_child0.getComputedWidth()).toBe(14); expect(root_child0_child0_child0.getComputedHeight()).toBe(9); }); test.skip('box_sizing_content_box_flex_basis_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setHeight(25); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 10); root_child0.setBoxSizing(BoxSizing.ContentBox); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(55); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(55); }); test('box_sizing_border_box_flex_basis_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setHeight(25); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(30); }); test.skip('box_sizing_content_box_flex_basis_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setHeight(25); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 10); root_child0.setBoxSizing(BoxSizing.ContentBox); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); }); test('box_sizing_border_box_flex_basis_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setHeight(25); root_child0.setPadding(Edge.All, 5); root_child0.setBorder(Edge.All, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); }); test('box_sizing_content_box_padding_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.Start, 5); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_padding_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.Start, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_content_box_padding_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.End, 5); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_padding_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.End, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_content_box_border_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.Start, 5); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_border_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.Start, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_content_box_border_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.End, 5); root.setBoxSizing(BoxSizing.ContentBox); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(105); expect(root.getComputedHeight()).toBe(100); }); test('box_sizing_border_box_border_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setBorder(Edge.End, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); }); ================================================ FILE: javascript/tests/generated/YGDimensionTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGDimensionTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('wrap_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); }); test('wrap_grandchild', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0_child0.setHeight(100); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); }); ================================================ FILE: javascript/tests/generated/YGDisplayContentsTest.test.ts ================================================ /** * 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<> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayContentsTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('test1', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setFlexDirection(FlexDirection.Row); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(1); root_child0_child1.setFlexShrink(1); root_child0_child1.setFlexBasis("0%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); }); ================================================ FILE: javascript/tests/generated/YGDisplayTest.test.ts ================================================ /** * 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<<135c335cb45389e0859be2e94573299d>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGDisplayTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('display_none', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setDisplay(Display.None); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); }); test('display_none_fixed_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root_child1.setDisplay(Display.None); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); }); test('display_none_with_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setDisplay(Display.None); root_child0.setMargin(Edge.All, 10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); }); test('display_none_with_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setDisplay(Display.None); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexGrow(1); root_child1_child0.setFlexShrink(1); root_child1_child0.setFlexBasis("0%"); root_child1_child0.setWidth(20); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(0); expect(root_child1_child0.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(0); expect(root_child1_child0.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(100); }); test('display_none_with_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setDisplay(Display.None); root_child1.setPosition(Edge.Top, 10); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); }); test('display_none_with_position_absolute', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.None); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); }); test('display_contents', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(1); root_child0_child1.setFlexShrink(1); root_child0_child1.setFlexBasis("0%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); }); test('display_contents_fixed_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(1); root_child0_child1.setFlexShrink(1); root_child0_child1.setFlexBasis("0%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); }); test('display_contents_with_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setDisplay(Display.Contents); root_child0.setMargin(Edge.All, 10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); }); test('display_contents_with_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root_child0.setPadding(Edge.All, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(1); root_child0_child1.setFlexShrink(1); root_child0_child1.setFlexBasis("0%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); }); test('display_contents_with_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root_child0.setPosition(Edge.Top, 10); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(1); root_child0_child1.setFlexShrink(1); root_child0_child1.setFlexBasis("0%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); }); test('display_contents_with_position_absolute', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root_child0.setPositionType(PositionType.Absolute); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(1); root_child0_child1.setFlexShrink(1); root_child0_child1.setFlexBasis("0%"); root_child0_child1.setHeight(20); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(20); }); test('display_contents_nested', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setDisplay(Display.Contents); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setDisplay(Display.Contents); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0_child0.setFlexBasis("0%"); root_child0_child0_child0.setHeight(10); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setFlexGrow(1); root_child0_child0_child1.setFlexShrink(1); root_child0_child0_child1.setFlexBasis("0%"); root_child0_child0_child1.setHeight(20); root_child0_child0.insertChild(root_child0_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child0_child1.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child0_child1.getComputedHeight()).toBe(20); }); test('display_contents_with_siblings', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setHeight(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setDisplay(Display.Contents); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexGrow(1); root_child1_child0.setFlexShrink(1); root_child1_child0.setFlexBasis("0%"); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setFlexGrow(1); root_child1_child1.setFlexShrink(1); root_child1_child1.setFlexBasis("0%"); root_child1_child1.setHeight(20); root_child1.insertChild(root_child1_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root_child2.setHeight(30); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child1_child0.getComputedLeft()).toBe(25); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child1_child1.getComputedLeft()).toBe(50); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(25); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child1_child0.getComputedLeft()).toBe(50); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(25); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child1_child1.getComputedLeft()).toBe(25); expect(root_child1_child1.getComputedTop()).toBe(0); expect(root_child1_child1.getComputedWidth()).toBe(25); expect(root_child1_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(30); }); ================================================ FILE: javascript/tests/generated/YGFlexBasisFitContentTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexBasisFitContentTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('container_child_overflows_definite_parent_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(300); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(500); root_child0_child0.setWidth(50); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(500); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(150); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(500); }); test('container_child_overflows_definite_parent_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(500); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(-200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(50); }); test('container_child_within_bounds_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(300); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(50); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(150); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(100); }); test('multiple_container_children_overflow_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(300); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(400); root_child0.insertChild(root_child0_child0, 0); const root_child1 = Yoga.Node.create(config); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setHeight(500); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(400); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(400); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(500); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(200); expect(root_child1_child0.getComputedHeight()).toBe(500); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(400); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(400); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(500); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(200); expect(root_child1_child0.getComputedHeight()).toBe(500); }); test('scroll_container_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(300); root.setOverflow(Overflow.Scroll); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(500); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(500); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(500); }); test('explicit_and_container_children_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(300); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setHeight(500); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(500); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(200); expect(root_child1_child0.getComputedHeight()).toBe(500); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(500); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(200); expect(root_child1_child0.getComputedHeight()).toBe(500); }); test('flex_basis_in_scroll_content_container', () => { const config = Yoga.Config.create(); config.setExperimentalFeatureEnabled(ExperimentalFeature.FixFlexBasisFitContent, true); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(300); root.setOverflow(Overflow.Scroll); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexBasis(200); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexBasis(300); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(200); expect(root_child0_child1.getComputedWidth()).toBe(200); expect(root_child0_child1.getComputedHeight()).toBe(300); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(200); expect(root_child0_child1.getComputedWidth()).toBe(200); expect(root_child0_child1.getComputedHeight()).toBe(300); }); ================================================ FILE: javascript/tests/generated/YGFlexDirectionTest.test.ts ================================================ /** * 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<<97395ee324d465dfd6129aba6426ab69>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexDirectionTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('flex_direction_column_no_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(10); }); test('flex_direction_row_no_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(10); }); test('flex_direction_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_column_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(90); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(80); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(70); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(90); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(80); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(70); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(10); }); test('flex_direction_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_margin_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setMargin(Edge.Left, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_margin_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setMargin(Edge.Start, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_margin_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setMargin(Edge.Right, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_margin_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setMargin(Edge.End, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_column_reverse_margin_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); root.setMargin(Edge.Top, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(100); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(100); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); }); test('flex_direction_column_reverse_margin_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); root.setMargin(Edge.Bottom, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_padding_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setPadding(Edge.Left, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(110); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(120); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_padding_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setPadding(Edge.Start, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_padding_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setPadding(Edge.Right, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(-20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(-30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_padding_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setPadding(Edge.End, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(-20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(-30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(110); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(120); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_column_reverse_padding_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); root.setPadding(Edge.Top, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); }); test('flex_direction_column_reverse_padding_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); root.setPadding(Edge.Bottom, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_border_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setBorder(Edge.Left, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(110); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(120); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_border_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setBorder(Edge.Start, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(80); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_border_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setBorder(Edge.Right, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(-20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(-30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_border_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.RowReverse); root.setBorder(Edge.End, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(-20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(-30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(110); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(120); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(100); }); test('flex_direction_column_reverse_border_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); root.setBorder(Edge.Top, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); }); test('flex_direction_column_reverse_border_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); root.setFlexDirection(FlexDirection.ColumnReverse); root.setBorder(Edge.Bottom, 100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(90); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(90); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_pos_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.setPosition(Edge.Left, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(80); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(70); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(10); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_pos_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.setPosition(Edge.Start, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(80); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(70); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(10); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_pos_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.setPosition(Edge.Right, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(80); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(70); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(10); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_pos_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.setPosition(Edge.End, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(-100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(80); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(70); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(10); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(20); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_column_reverse_pos_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root_child0.setPosition(Edge.Top, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_column_reverse_pos_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root_child0.setPosition(Edge.Bottom, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-100); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-100); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(0); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_inner_pos_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPosition(Edge.Left, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_pos_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPosition(Edge.Right, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_col_reverse_inner_pos_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPosition(Edge.Top, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_col_reverse_inner_pos_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPosition(Edge.Bottom, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(80); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(80); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test.skip('flex_direction_row_reverse_inner_pos_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPosition(Edge.Start, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test.skip('flex_direction_row_reverse_inner_pos_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPosition(Edge.End, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_margin_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setMargin(Edge.Left, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_margin_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setMargin(Edge.Right, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_col_reverse_inner_margin_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setMargin(Edge.Top, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_col_reverse_inner_margin_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setMargin(Edge.Bottom, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(80); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(80); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_inner_marign_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setMargin(Edge.Start, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_margin_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setMargin(Edge.End, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(80); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_border_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setBorder(Edge.Left, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_border_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setBorder(Edge.Right, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_col_reverse_inner_border_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setBorder(Edge.Top, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_col_reverse_inner_border_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setBorder(Edge.Bottom, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_inner_border_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setBorder(Edge.Start, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_border_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setBorder(Edge.End, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_padding_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPadding(Edge.Left, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_padding_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPadding(Edge.Right, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_col_reverse_inner_padding_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPadding(Edge.Top, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_col_reverse_inner_padding_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPadding(Edge.Bottom, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(90); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(100); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(0); expect(root_child0_child2.getComputedLeft()).toBe(90); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(0); }); test('flex_direction_row_reverse_inner_padding_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPadding(Edge.Start, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_row_reverse_inner_padding_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.setPadding(Edge.End, 10); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(10); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(90); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(80); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(10); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(10); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(10); expect(root_child0_child2.getComputedHeight()).toBe(100); }); test('flex_direction_alternating_with_percent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(300); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("50%"); root_child0.setWidth("50%"); root_child0.setPosition(Edge.Left, "10%"); root_child0.setPosition(Edge.Top, "10%"); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(120); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); }); ================================================ FILE: javascript/tests/generated/YGFlexTest.test.ts ================================================ /** * 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<<845e100082da2dc28f3ff2cbca24c9ab>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('flex_basis_flex_grow_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(75); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(75); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); }); test('flex_shrink_flex_grow_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setHeight(500); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(100); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(500); root_child1.setHeight(100); root_child1.setFlexShrink(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(250); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(250); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(250); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(250); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(250); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(250); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_shrink_flex_grow_child_flex_shrink_other_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setHeight(500); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(100); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(500); root_child1.setHeight(100); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(250); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(250); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(250); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(250); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(250); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(250); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_basis_flex_grow_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(75); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(25); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(75); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_basis_flex_shrink_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(100); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); }); test('flex_basis_flex_shrink_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(100); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_shrink_to_zero', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(75); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root_child1.setFlexShrink(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(75); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(75); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('flex_basis_overrides_main_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(20); }); test('flex_grow_shrink_at_most', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(0); }); test('flex_grow_less_than_factor_one', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(0.2); root_child0.setFlexBasis(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(0.2); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(0.4); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(132); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(132); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(92); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(224); expect(root_child2.getComputedWidth()).toBe(200); expect(root_child2.getComputedHeight()).toBe(184); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(132); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(132); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(92); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(224); expect(root_child2.getComputedWidth()).toBe(200); expect(root_child2.getComputedHeight()).toBe(184); }); ================================================ FILE: javascript/tests/generated/YGFlexWrapTest.test.ts ================================================ /** * 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<<7fb4c69ffa58579fd0ce6fd9b61210bf>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexWrapTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test.skip('wrap_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(30); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(30); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(30); root_child3.setWidth(30); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(60); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(30); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(60); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(-30); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); }); test('wrap_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(30); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(30); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(30); root_child3.setWidth(30); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(60); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(60); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); }); test('wrap_row_align_items_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(30); root_child3.setWidth(30); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(60); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(60); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); }); test('wrap_row_align_items_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(30); root_child3.setWidth(30); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(60); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(5); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(60); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(5); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(30); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(30); }); test('flex_wrap_children_with_min_main_overriding_flex_basis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setHeight(50); root_child0.setMinWidth(55); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(50); root_child1.setHeight(50); root_child1.setMinWidth(55); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(55); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(55); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(45); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(55); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(45); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(55); expect(root_child1.getComputedHeight()).toBe(50); }); test('flex_wrap_wrap_to_child_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setAlignItems(Align.FlexStart); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(100); root_child0_child0_child0.setWidth(100); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_wrap_align_stretch_fits_one_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(150); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(150); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(0); }); test('wrap_reverse_row_align_content_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.WrapReverse); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(40); root_child3.setWidth(30); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root_child4.setWidth(30); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(40); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); }); test('wrap_reverse_row_align_content_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.WrapReverse); root.setAlignContent(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(40); root_child3.setWidth(30); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root_child4.setWidth(30); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(40); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); }); test('wrap_reverse_row_single_line_different_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.WrapReverse); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(40); root_child3.setWidth(30); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root_child4.setWidth(30); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(40); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(90); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(120); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(270); expect(root_child0.getComputedTop()).toBe(40); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(240); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(210); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(180); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(150); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); }); test('wrap_reverse_row_align_content_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.WrapReverse); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(40); root_child3.setWidth(30); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root_child4.setWidth(30); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(40); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); }); test('wrap_reverse_row_align_content_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.WrapReverse); root.setAlignContent(Align.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(40); root_child3.setWidth(30); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root_child4.setWidth(30); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(70); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(10); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(40); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); }); test('wrap_reverse_column_fixed_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(100); root.setFlexWrap(Wrap.WrapReverse); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(30); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root_child1.setWidth(30); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root_child2.setWidth(30); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setHeight(40); root_child3.setWidth(30); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root_child4.setWidth(30); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(170); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(170); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(170); expect(root_child2.getComputedTop()).toBe(30); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(170); expect(root_child3.getComputedTop()).toBe(60); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(140); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(30); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(30); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(60); expect(root_child3.getComputedWidth()).toBe(30); expect(root_child3.getComputedHeight()).toBe(40); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(30); expect(root_child4.getComputedHeight()).toBe(50); }); test('wrapped_row_within_align_items_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(150); root_child0_child0.setHeight(80); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(80); root_child0_child1.setHeight(80); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(160); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(150); expect(root_child0_child0.getComputedHeight()).toBe(80); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(80); expect(root_child0_child1.getComputedWidth()).toBe(80); expect(root_child0_child1.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(160); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(150); expect(root_child0_child0.getComputedHeight()).toBe(80); expect(root_child0_child1.getComputedLeft()).toBe(120); expect(root_child0_child1.getComputedTop()).toBe(80); expect(root_child0_child1.getComputedWidth()).toBe(80); expect(root_child0_child1.getComputedHeight()).toBe(80); }); test('wrapped_row_within_align_items_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(150); root_child0_child0.setHeight(80); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(80); root_child0_child1.setHeight(80); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(160); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(150); expect(root_child0_child0.getComputedHeight()).toBe(80); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(80); expect(root_child0_child1.getComputedWidth()).toBe(80); expect(root_child0_child1.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(160); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(150); expect(root_child0_child0.getComputedHeight()).toBe(80); expect(root_child0_child1.getComputedLeft()).toBe(120); expect(root_child0_child1.getComputedTop()).toBe(80); expect(root_child0_child1.getComputedWidth()).toBe(80); expect(root_child0_child1.getComputedHeight()).toBe(80); }); test('wrapped_row_within_align_items_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(150); root_child0_child0.setHeight(80); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(80); root_child0_child1.setHeight(80); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(160); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(150); expect(root_child0_child0.getComputedHeight()).toBe(80); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(80); expect(root_child0_child1.getComputedWidth()).toBe(80); expect(root_child0_child1.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(160); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(150); expect(root_child0_child0.getComputedHeight()).toBe(80); expect(root_child0_child1.getComputedLeft()).toBe(120); expect(root_child0_child1.getComputedTop()).toBe(80); expect(root_child0_child1.getComputedWidth()).toBe(80); expect(root_child0_child1.getComputedHeight()).toBe(80); }); test('wrapped_column_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); root.setWidth(700); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); root.setAlignContent(Align.Center); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(500); root_child0.setMaxHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(200); root_child1.setHeight(200); root_child1.setMargin(Edge.All, 20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(700); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(250); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(200); expect(root_child1.getComputedTop()).toBe(250); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(200); expect(root_child2.getComputedLeft()).toBe(420); expect(root_child2.getComputedTop()).toBe(200); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(700); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(350); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(300); expect(root_child1.getComputedTop()).toBe(250); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(200); expect(root_child2.getComputedLeft()).toBe(180); expect(root_child2.getComputedTop()).toBe(200); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); }); test('wrapped_column_max_height_flex', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); root.setWidth(700); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); root.setAlignContent(Align.Center); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(500); root_child0.setMaxHeight(200); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(200); root_child1.setHeight(200); root_child1.setMargin(Edge.All, 20); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(700); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(300); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(180); expect(root_child1.getComputedLeft()).toBe(250); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(180); expect(root_child2.getComputedLeft()).toBe(300); expect(root_child2.getComputedTop()).toBe(400); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(700); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(300); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(180); expect(root_child1.getComputedLeft()).toBe(250); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(180); expect(root_child2.getComputedLeft()).toBe(300); expect(root_child2.getComputedTop()).toBe(400); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); }); test('wrap_nodes_with_content_sizing_overflowing_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setWidth(85); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(40); root_child0_child0_child0.setWidth(40); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setMargin(Edge.Right, 10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child1_child0 = Yoga.Node.create(config); root_child0_child1_child0.setHeight(40); root_child0_child1_child0.setWidth(40); root_child0_child1.insertChild(root_child0_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(85); expect(root_child0.getComputedHeight()).toBe(80); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(40); expect(root_child0_child1.getComputedWidth()).toBe(40); expect(root_child0_child1.getComputedHeight()).toBe(40); expect(root_child0_child1_child0.getComputedLeft()).toBe(0); expect(root_child0_child1_child0.getComputedTop()).toBe(0); expect(root_child0_child1_child0.getComputedWidth()).toBe(40); expect(root_child0_child1_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(415); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(85); expect(root_child0.getComputedHeight()).toBe(80); expect(root_child0_child0.getComputedLeft()).toBe(45); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child1.getComputedLeft()).toBe(35); expect(root_child0_child1.getComputedTop()).toBe(40); expect(root_child0_child1.getComputedWidth()).toBe(40); expect(root_child0_child1.getComputedHeight()).toBe(40); expect(root_child0_child1_child0.getComputedLeft()).toBe(0); expect(root_child0_child1_child0.getComputedTop()).toBe(0); expect(root_child0_child1_child0.getComputedWidth()).toBe(40); expect(root_child0_child1_child0.getComputedHeight()).toBe(40); }); test('wrap_nodes_with_content_sizing_margin_cross', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setWidth(70); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(40); root_child0_child0_child0.setWidth(40); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setMargin(Edge.Top, 10); root_child0.insertChild(root_child0_child1, 1); const root_child0_child1_child0 = Yoga.Node.create(config); root_child0_child1_child0.setHeight(40); root_child0_child1_child0.setWidth(40); root_child0_child1.insertChild(root_child0_child1_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(70); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(40); expect(root_child0_child1.getComputedHeight()).toBe(40); expect(root_child0_child1_child0.getComputedLeft()).toBe(0); expect(root_child0_child1_child0.getComputedTop()).toBe(0); expect(root_child0_child1_child0.getComputedWidth()).toBe(40); expect(root_child0_child1_child0.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(430); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(70); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child0_child0.getComputedLeft()).toBe(30); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(40); expect(root_child0_child1.getComputedLeft()).toBe(30); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(40); expect(root_child0_child1.getComputedHeight()).toBe(40); expect(root_child0_child1_child0.getComputedLeft()).toBe(0); expect(root_child0_child1_child0.getComputedTop()).toBe(0); expect(root_child0_child1_child0.getComputedWidth()).toBe(40); expect(root_child0_child1_child0.getComputedHeight()).toBe(40); }); test('wrap_with_min_cross_axis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMinHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('wrap_with_max_cross_axis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setMaxHeight(500); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(400); root_child1.setHeight(200); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(400); expect(root_child1.getComputedHeight()).toBe(200); }); test('nowrap_expands_flexline_box_to_min_cross', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(400); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(400); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(400); }); test('wrap_does_not_impose_min_cross_onto_single_flexline', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(400); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); }); ================================================ FILE: javascript/tests/generated/YGGapTest.test.ts ================================================ /** * 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<<155c006bb0b57fbfe652cb9eb71d1c66>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGGapTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('column_gap_flexible', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(80); root.setHeight(100); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_inflexible', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(80); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_mixed_flexible', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(80); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_child_margins', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(80); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Edge.Horizontal, 2); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setMargin(Edge.Horizontal, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root_child2.setMargin(Edge.Horizontal, 15); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(2); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(26); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(2); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(63); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(2); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(76); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(52); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(2); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(15); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(2); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_row_gap_wrapping', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(80); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); const root_child6 = Yoga.Node.create(config); root_child6.setWidth(20); root_child6.setHeight(20); root.insertChild(root_child6, 6); const root_child7 = Yoga.Node.create(config); root_child7.setWidth(20); root_child7.setHeight(20); root.insertChild(root_child7, 7); const root_child8 = Yoga.Node.create(config); root_child8.setWidth(20); root_child8.setHeight(20); root.insertChild(root_child8, 8); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(40); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(40); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(40); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); expect(root_child6.getComputedLeft()).toBe(0); expect(root_child6.getComputedTop()).toBe(80); expect(root_child6.getComputedWidth()).toBe(20); expect(root_child6.getComputedHeight()).toBe(20); expect(root_child7.getComputedLeft()).toBe(30); expect(root_child7.getComputedTop()).toBe(80); expect(root_child7.getComputedWidth()).toBe(20); expect(root_child7.getComputedHeight()).toBe(20); expect(root_child8.getComputedLeft()).toBe(60); expect(root_child8.getComputedTop()).toBe(80); expect(root_child8.getComputedWidth()).toBe(20); expect(root_child8.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(60); expect(root_child3.getComputedTop()).toBe(40); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(40); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(0); expect(root_child5.getComputedTop()).toBe(40); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); expect(root_child6.getComputedLeft()).toBe(60); expect(root_child6.getComputedTop()).toBe(80); expect(root_child6.getComputedWidth()).toBe(20); expect(root_child6.getComputedHeight()).toBe(20); expect(root_child7.getComputedLeft()).toBe(30); expect(root_child7.getComputedTop()).toBe(80); expect(root_child7.getComputedWidth()).toBe(20); expect(root_child7.getComputedHeight()).toBe(20); expect(root_child8.getComputedLeft()).toBe(0); expect(root_child8.getComputedTop()).toBe(80); expect(root_child8.getComputedWidth()).toBe(20); expect(root_child8.getComputedHeight()).toBe(20); }); test('column_gap_start_index', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(80); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(60); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); }); test('column_gap_justify_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_justify_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.Center); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(70); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_justify_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.FlexEnd); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_justify_space_between', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceBetween); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_justify_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceAround); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(3); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(77); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(77); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(3); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_justify_space_evenly', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceEvenly); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(5); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('column_gap_wrap_align_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(40); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(40); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(40); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(40); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(40); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(40); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); }); test('column_gap_wrap_align_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.Center); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(60); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(60); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(60); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(60); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(60); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(60); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); }); test('column_gap_wrap_align_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.FlexEnd); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(40); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(40); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(80); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(40); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(40); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(40); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(80); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); }); test('column_gap_wrap_align_space_between', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceBetween); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(80); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(80); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(80); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(80); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); }); test('column_gap_wrap_align_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setAlignContent(Align.SpaceAround); root.setWidth(100); root.setHeight(100); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(10); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(70); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(70); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(70); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(10); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(20); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(70); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(20); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(70); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(20); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(70); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(20); }); test('column_gap_wrap_align_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(300); root.setHeight(300); root.setGap(Gutter.Column, 5); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth(60); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setMinWidth(60); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setMinWidth(60); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setMinWidth(60); root_child3.setFlexGrow(1); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setMinWidth(60); root_child4.setFlexGrow(1); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(71); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(76); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(72); expect(root_child1.getComputedHeight()).toBe(150); expect(root_child2.getComputedLeft()).toBe(153); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(71); expect(root_child2.getComputedHeight()).toBe(150); expect(root_child3.getComputedLeft()).toBe(229); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(71); expect(root_child3.getComputedHeight()).toBe(150); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(150); expect(root_child4.getComputedWidth()).toBe(300); expect(root_child4.getComputedHeight()).toBe(150); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(229); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(71); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(153); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(71); expect(root_child1.getComputedHeight()).toBe(150); expect(root_child2.getComputedLeft()).toBe(76); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(72); expect(root_child2.getComputedHeight()).toBe(150); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(71); expect(root_child3.getComputedHeight()).toBe(150); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(150); expect(root_child4.getComputedWidth()).toBe(300); expect(root_child4.getComputedHeight()).toBe(150); }); test('column_gap_determines_parent_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setHeight(100); root.setGap(Gutter.Column, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(50); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(70); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(100); }); test('row_gap_align_items_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(100); root.setHeight(200); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(90); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(90); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(110); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(90); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(110); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(90); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(110); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(90); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(90); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(90); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(90); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(110); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(90); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(110); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(90); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(110); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(90); }); test('row_gap_align_items_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(100); root.setHeight(200); root.setGap(Gutter.Column, 10); root.setGap(Gutter.Row, 20); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root.insertChild(root_child4, 4); const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root.insertChild(root_child5, 5); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(0); expect(root_child3.getComputedTop()).toBe(20); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(0); expect(root_child4.getComputedLeft()).toBe(30); expect(root_child4.getComputedTop()).toBe(20); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(0); expect(root_child5.getComputedLeft()).toBe(60); expect(root_child5.getComputedTop()).toBe(20); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(0); expect(root_child3.getComputedLeft()).toBe(80); expect(root_child3.getComputedTop()).toBe(20); expect(root_child3.getComputedWidth()).toBe(20); expect(root_child3.getComputedHeight()).toBe(0); expect(root_child4.getComputedLeft()).toBe(50); expect(root_child4.getComputedTop()).toBe(20); expect(root_child4.getComputedWidth()).toBe(20); expect(root_child4.getComputedHeight()).toBe(0); expect(root_child5.getComputedLeft()).toBe(20); expect(root_child5.getComputedTop()).toBe(20); expect(root_child5.getComputedWidth()).toBe(20); expect(root_child5.getComputedHeight()).toBe(0); }); test('row_gap_column_child_margins', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(200); root.setGap(Gutter.Row, 10); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Edge.Vertical, 2); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setMargin(Edge.Vertical, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root_child2.setMargin(Edge.Vertical, 15); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(2); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(42); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(66); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(42); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(143); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(42); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(2); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(42); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(66); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(42); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(143); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(42); }); test('row_gap_row_wrap_child_margins', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexWrap(Wrap.Wrap); root.setWidth(100); root.setHeight(200); root.setGap(Gutter.Row, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(60); root_child0.setMargin(Edge.Vertical, 2); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(60); root_child1.setMargin(Edge.Vertical, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(60); root_child2.setMargin(Edge.Vertical, 15); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(2); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(24); expect(root_child1.getComputedWidth()).toBe(60); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(59); expect(root_child2.getComputedWidth()).toBe(60); expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(2); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(24); expect(root_child1.getComputedWidth()).toBe(60); expect(root_child1.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(59); expect(root_child2.getComputedWidth()).toBe(60); expect(root_child2.getComputedHeight()).toBe(0); }); test('row_gap_determines_parent_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setGap(Gutter.Row, 10); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(30); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(20); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(50); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(30); }); test('row_gap_percent_wrapping', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(700); root.setPadding(Edge.All, 10); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(138); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(138); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(10); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(190); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(62); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(190); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(62); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(190); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); test('row_gap_percent_determines_parent_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(130); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(130); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(200); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(70); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(200); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(200); expect(root_child4.getComputedTop()).toBe(200); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); test('row_gap_percent_wrapping_with_both_content_padding_and_item_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(700); root.setPadding(Edge.All, 10); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setPadding(Edge.All, 10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root_child1.setPadding(Edge.All, 10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root_child2.setPadding(Edge.All, 10); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root_child3.setPadding(Edge.All, 10); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root_child4.setPadding(Edge.All, 10); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(138); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(138); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(10); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(190); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(62); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(190); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(62); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(190); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); test('row_gap_percent_wrapping_with_both_content_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(700); root.setPadding(Edge.All, 10); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(138); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(138); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(10); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(190); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(62); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(190); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(62); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(190); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); test('row_gap_percent_wrapping_with_content_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(700); root.setMargin(Edge.All, 10); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(10); expect(root.getComputedTop()).toBe(10); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(130); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(170); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(130); expect(root_child3.getComputedTop()).toBe(170); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(340); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(10); expect(root.getComputedTop()).toBe(10); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(70); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(200); expect(root_child2.getComputedTop()).toBe(170); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(170); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(200); expect(root_child4.getComputedTop()).toBe(340); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); test('row_gap_percent_wrapping_with_content_margin_and_padding', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(700); root.setMargin(Edge.All, 10); root.setPadding(Edge.All, 10); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(10); expect(root.getComputedTop()).toBe(10); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(138); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(10); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(138); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(10); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(10); expect(root.getComputedTop()).toBe(10); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(700); expect(root_child0.getComputedLeft()).toBe(190); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(62); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(190); expect(root_child2.getComputedTop()).toBe(178); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(62); expect(root_child3.getComputedTop()).toBe(178); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(190); expect(root_child4.getComputedTop()).toBe(346); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); test('row_gap_percent_wrapping_with_flexible_content', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(300); root.setGap(Gutter.All, "10%"); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child1.getComputedLeft()).toBe(110); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(80); expect(root_child1.getComputedHeight()).toBe(300); expect(root_child2.getComputedLeft()).toBe(220); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(80); expect(root_child2.getComputedHeight()).toBe(300); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(220); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child1.getComputedLeft()).toBe(110); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(80); expect(root_child1.getComputedHeight()).toBe(300); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(80); expect(root_child2.getComputedHeight()).toBe(300); }); test('row_gap_percent_wrapping_with_mixed_flexible_content', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(300); root.setHeight(300); root.setGap(Gutter.All, "10%"); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth("10%"); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(300); expect(root_child2.getComputedLeft()).toBe(270); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(300); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(290); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(300); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(300); }); test.skip('row_gap_percent_wrapping_with_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMinWidth(300); root.setGap(Gutter.All, "10%"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setWidth(100); root_child3.setHeight(100); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setWidth(100); root_child4.setHeight(100); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(130); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(130); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(200); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(70); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(200); expect(root_child2.getComputedTop()).toBe(100); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(70); expect(root_child3.getComputedTop()).toBe(100); expect(root_child3.getComputedWidth()).toBe(100); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(200); expect(root_child4.getComputedTop()).toBe(200); expect(root_child4.getComputedWidth()).toBe(100); expect(root_child4.getComputedHeight()).toBe(100); }); ================================================ FILE: javascript/tests/generated/YGIntrinsicSizeTest.test.ts ================================================ /** * 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<<4ea148a3d3f6abbfb0bdcfc9d7b2779c>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('contains_inner_text_long_word', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "LoremipsumdolorsitametconsecteturadipiscingelitSedeleifasdfettortoracauctorFuscerhoncusipsumtemporerosaliquamconsequatPraesentsoda", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1300); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(700); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1300); expect(root_child0.getComputedHeight()).toBe(10); }); test('contains_inner_text_no_width_no_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(70); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(70); }); test('contains_inner_text_no_width_no_height_long_word_in_paragraph', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(70); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(70); }); test('contains_inner_text_fixed_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setWidth(100); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(1290); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(1900); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(1290); }); test('contains_inner_text_no_width_fixed_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setHeight(20); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(20); }); test('contains_inner_text_fixed_width_fixed_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setWidth(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(1950); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(20); }); test('contains_inner_text_max_width_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxWidth(50); root_child0.setMaxHeight(20); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(1950); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(20); }); test('contains_inner_text_max_width_max_height_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth(50); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Column})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(1890); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(1890); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(1890); expect(root_child0.getComputedLeft()).toBe(1950); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(1890); }); test('contains_inner_text_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxWidth(100); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(1290); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(1900); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(1290); }); test('contains_inner_text_fixed_width_shorter_text', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setWidth(100); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(1900); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(20); }); test('contains_inner_text_fixed_height_shorter_text', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setHeight(100); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(110); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(1890); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(110); expect(root_child0.getComputedHeight()).toBe(100); }); test('contains_inner_text_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(2000); root.setHeight(2000); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxHeight(20); root.insertChild(root_child0, 0); root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "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.", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(2000); expect(root.getComputedHeight()).toBe(2000); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(2000); expect(root_child0.getComputedHeight()).toBe(20); }); test('max_content_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth("max-content"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(175); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(150); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(175); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(125); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(25); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); }); test.skip('fit_content_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setWidth("fit-content"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(75); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test('stretch_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setWidth("stretch"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(150); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(450); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(350); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(325); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test('max_content_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight("max-content"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(25); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(175); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(175); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); }); test.skip('fit_content_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("fit-content"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test.skip('stretch_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("stretch"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test('max_content_flex_basis_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexBasis("max-content"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(25); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(175); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(175); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); }); test.skip('fit_content_flex_basis_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis("fit-content"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test('stretch_flex_basis_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis("stretch"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(175); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test.skip('max_content_flex_basis_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setFlexBasis("max-content"); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(500); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(600); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(500); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(550); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(600); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(500); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(550); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); }); test.skip('fit_content_flex_basis_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexBasis("fit-content"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(90); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(40); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(-10); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(65); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test.skip('stretch_flex_basis_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setFlexBasis("stretch"); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(150); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(450); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(350); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(325); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test.skip('max_content_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMaxWidth("max-content"); root.setWidth(200); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(175); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(150); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(175); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(125); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(25); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); }); test.skip('fit_content_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxWidth("fit-content"); root_child0.setWidth(110); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(75); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test.skip('stretch_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxWidth("stretch"); root_child0.setWidth(600); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(150); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(450); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(350); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(325); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test.skip('max_content_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMinWidth("max-content"); root.setWidth(100); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(25); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(175); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(150); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(175); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(125); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(25); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(50); }); test.skip('fit_content_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(90); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMinWidth("fit-content"); root_child0.setWidth(90); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(90); expect(root.getComputedHeight()).toBe(150); expect(root_child0.getComputedLeft()).toBe(-10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(75); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test.skip('stretch_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMinWidth("stretch"); root_child0.setWidth(400); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(100); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(25); root_child0_child2.setHeight(50); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(150); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(450); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(350); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(325); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); test.skip('max_content_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxHeight("max-content"); root.setHeight(200); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(25); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(175); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(175); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); }); test.skip('fit_content_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); root_child0.setMaxHeight("fit-content"); root_child0.setHeight(110); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(100); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(-50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(-100); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test.skip('stretch_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setMaxHeight("stretch"); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setHeight(600); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test.skip('max_content_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight("max-content"); root.setHeight(100); root.setFlexWrap(Wrap.Wrap); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(100); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(25); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(-50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(-100); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(25); }); test.skip('fit_content_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(90); const root_child0 = Yoga.Node.create(config); root_child0.setMinHeight("fit-content"); root_child0.setHeight(90); root_child0.setFlexWrap(Wrap.Wrap); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(100); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(90); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(-50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(-100); expect(root_child0_child2.getComputedTop()).toBe(0); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test.skip('stretch_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setMinHeight("stretch"); root_child0.setFlexWrap(Wrap.Wrap); root_child0.setHeight(400); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setWidth(50); root_child0_child2.setHeight(25); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(50); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child2.getComputedLeft()).toBe(0); expect(root_child0_child2.getComputedTop()).toBe(150); expect(root_child0_child2.getComputedWidth()).toBe(50); expect(root_child0_child2.getComputedHeight()).toBe(25); }); test.skip('text_max_content_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("max-content"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1140); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1140); expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(-940); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1140); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1140); expect(root_child0_child0.getComputedHeight()).toBe(10); }); test.skip('text_stretch_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("stretch"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); }); test.skip('text_fit_content_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("fit-content"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(870); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(870); expect(root_child0_child0.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(-670); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(870); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(870); expect(root_child0_child0.getComputedHeight()).toBe(30); }); test.skip('text_max_content_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth("max-content"); root_child0.setWidth(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1140); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1140); expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(-940); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1140); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1140); expect(root_child0_child0.getComputedHeight()).toBe(10); }); test.skip('text_stretch_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth("stretch"); root_child0.setWidth(100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); }); test.skip('text_fit_content_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth("fit-content"); root_child0.setWidth(300); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(870); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(870); expect(root_child0_child0.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(-670); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(870); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(870); expect(root_child0_child0.getComputedHeight()).toBe(30); }); test.skip('text_max_content_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth("max-content"); root_child0.setWidth(2000); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1140); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1140); expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(-940); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1140); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(1140); expect(root_child0_child0.getComputedHeight()).toBe(10); }); test.skip('text_stretch_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth("stretch"); root_child0.setWidth(300); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); }); test.skip('text_fit_content_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth("fit-content"); root_child0.setWidth(1000); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0.insertChild(root_child0_child0, 0); root_child0_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet", flexDirection: FlexDirection.Row})); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(870); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(870); expect(root_child0_child0.getComputedHeight()).toBe(30); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(-670); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(870); expect(root_child0.getComputedHeight()).toBe(30); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(870); expect(root_child0_child0.getComputedHeight()).toBe(30); }); ================================================ FILE: javascript/tests/generated/YGJustifyContentTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGJustifyContentTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('justify_content_row_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(20); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(92); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(82); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(72); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_row_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(72); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(82); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(92); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(10); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_row_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(36); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(46); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(56); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(56); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(46); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(36); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_row_space_between', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceBetween); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(46); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(92); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(92); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(46); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_row_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(12); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(46); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(46); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(12); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_column_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(10); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(20); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_column_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setJustifyContent(Justify.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(72); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(82); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(92); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(72); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(82); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(92); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_column_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(36); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(56); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(36); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(56); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_column_space_between', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setJustifyContent(Justify.SpaceBetween); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(92); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(92); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_column_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setJustifyContent(Justify.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(12); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(12); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_row_min_width_and_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(50); root.setMargin(Edge.Left, 100); root.setJustifyContent(Justify.Center); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setWidth(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(15); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(15); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('justify_content_row_max_width_and_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setMaxWidth(80); root.setMargin(Edge.Left, 100); root.setJustifyContent(Justify.Center); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setWidth(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(100); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(80); expect(root.getComputedHeight()).toBe(20); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('justify_content_column_min_height_and_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(50); root.setMargin(Edge.Top, 100); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setWidth(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(100); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(100); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(15); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('justify_content_column_max_height_and_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setMaxHeight(80); root.setMargin(Edge.Top, 100); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setWidth(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(100); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(100); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(80); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(30); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(20); }); test('justify_content_column_space_evenly', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setJustifyContent(Justify.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(18); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(74); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(18); expect(root_child0.getComputedWidth()).toBe(102); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(46); expect(root_child1.getComputedWidth()).toBe(102); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(74); expect(root_child2.getComputedWidth()).toBe(102); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_row_space_evenly', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setJustifyContent(Justify.SpaceEvenly); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(26); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(51); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(77); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(0); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(77); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(51); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(26); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(0); expect(root_child2.getComputedHeight()).toBe(10); }); test('justify_content_min_width_with_padding_child_width_greater_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(1000); root.setHeight(1584); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setAlignContent(Align.Stretch); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0.setJustifyContent(Justify.Center); root_child0_child0.setAlignContent(Align.Stretch); root_child0_child0.setMinWidth(400); root_child0_child0.setPadding(Edge.Left, 100); root_child0_child0.setPadding(Edge.Right, 100); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(100); root_child0_child0_child0.setWidth(300); root_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(1000); expect(root.getComputedHeight()).toBe(1584); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1000); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(300); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(1000); expect(root.getComputedHeight()).toBe(1584); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1000); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(500); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(500); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(300); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); }); test('justify_content_min_width_with_padding_child_width_lower_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(1080); root.setHeight(1584); root.setAlignContent(Align.Stretch); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setAlignContent(Align.Stretch); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0.setJustifyContent(Justify.Center); root_child0_child0.setAlignContent(Align.Stretch); root_child0_child0.setMinWidth(400); root_child0_child0.setPadding(Edge.Left, 100); root_child0_child0.setPadding(Edge.Right, 100); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(100); root_child0_child0_child0.setWidth(199); root_child0_child0_child0.setAlignContent(Align.Stretch); root_child0_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(1080); expect(root.getComputedHeight()).toBe(1584); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1080); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(400); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(101); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(199); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(1080); expect(root.getComputedHeight()).toBe(1584); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(1080); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(680); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(400); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(101); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(199); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); }); test('justify_content_space_between_indefinite_container_dim_with_free_space', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(300); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMinWidth(200); root_child0.setJustifyContent(Justify.SpaceBetween); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(50); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0_child1.setHeight(50); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(150); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(300); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(150); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(50); }); test('justify_content_flex_start_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.RowReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('justify_content_flex_end_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.RowReverse); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(20); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(20); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(40); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(20); expect(root_child2.getComputedHeight()).toBe(100); }); test('justify_content_overflow_row_flex_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(62); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(-18); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_overflow_row_flex_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(-18); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(62); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_overflow_row_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(-9); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(31); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(71); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(71); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(31); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(-9); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_overflow_row_space_between', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceBetween); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(62); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(-18); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_overflow_row_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(62); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(-18); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_overflow_row_space_evenly', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(62); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(-18); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test.skip('justify_content_overflow_row_reverse_space_around', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.RowReverse); root.setJustifyContent(Justify.SpaceAround); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(-18); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(62); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test.skip('justify_content_overflow_row_reverse_space_evenly', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.RowReverse); root.setJustifyContent(Justify.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(-18); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(62); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); test('justify_content_overflow_row_space_evenly_auto_margin', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(102); root.setHeight(102); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.SpaceEvenly); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(40); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(40); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(80); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(102); expect(root.getComputedHeight()).toBe(102); expect(root_child0.getComputedLeft()).toBe(62); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(40); expect(root_child0.getComputedHeight()).toBe(102); expect(root_child1.getComputedLeft()).toBe(22); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(102); expect(root_child2.getComputedLeft()).toBe(-18); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(40); expect(root_child2.getComputedHeight()).toBe(102); }); ================================================ FILE: javascript/tests/generated/YGMarginTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGMarginTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('margin_start', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setMargin(Edge.Start, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); }); test('margin_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setMargin(Edge.Top, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); }); test('margin_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setJustifyContent(Justify.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setMargin(Edge.End, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(100); }); test('margin_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setJustifyContent(Justify.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setMargin(Edge.Bottom, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(10); }); test('margin_and_flex_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Start, 10); root_child0.setMargin(Edge.End, 10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); }); test('margin_and_flex_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 10); root_child0.setMargin(Edge.Bottom, 10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); }); test('margin_and_stretch_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 10); root_child0.setMargin(Edge.Bottom, 10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(80); }); test('margin_and_stretch_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Start, 10); root_child0.setMargin(Edge.End, 10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(100); }); test('margin_with_sibling_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.End, 10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(45); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(55); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(45); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(55); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(45); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(45); expect(root_child1.getComputedHeight()).toBe(100); }); test('margin_with_sibling_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Bottom, 10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(45); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(45); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(45); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(55); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(45); }); test('margin_auto_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Bottom, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Top, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_bottom_and_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Top, "auto"); root_child0.setMargin(Edge.Bottom, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_bottom_and_top_justify_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Top, "auto"); root_child0.setMargin(Edge.Bottom, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_multiple_children_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Top, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root_child1.setMargin(Edge.Top, "auto"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(25); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(25); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(100); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(75); expect(root_child2.getComputedTop()).toBe(150); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('margin_auto_multiple_children_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root_child1.setMargin(Edge.Right, "auto"); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(150); expect(root_child2.getComputedTop()).toBe(75); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(125); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(75); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('margin_auto_left_and_right_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Left, "auto"); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_left_and_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Left, "auto"); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_start_and_end_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Start, "auto"); root_child0.setMargin(Edge.End, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(75); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_start_and_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Start, "auto"); root_child0.setMargin(Edge.End, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_left_and_right_column_and_center', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Left, "auto"); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_left', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Left, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_left_and_right_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Left, "auto"); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_top_and_bottom_stretch', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root_child0.setMargin(Edge.Top, "auto"); root_child0.setMargin(Edge.Bottom, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(50); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(150); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_should_not_be_part_of_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(250); root.setHeight(250); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setMaxHeight(100); root_child0.setMargin(Edge.Top, 20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); }); test('margin_should_not_be_part_of_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(250); root.setHeight(250); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setMaxWidth(100); root_child0.setMargin(Edge.Left, 20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(250); expect(root.getComputedHeight()).toBe(250); expect(root_child0.getComputedLeft()).toBe(150); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); }); test('margin_auto_left_right_child_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(72); root_child0.setHeight(72); root_child0.setMargin(Edge.Left, "auto"); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-20); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); }); test('margin_auto_left_child_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(72); root_child0.setHeight(72); root_child0.setMargin(Edge.Left, "auto"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-20); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); }); test('margin_fix_left_auto_right_child_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(72); root_child0.setHeight(72); root_child0.setMargin(Edge.Left, 10); root_child0.setMargin(Edge.Right, "auto"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-20); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); }); test('margin_auto_left_fix_right_child_bigger_than_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(52); root.setWidth(52); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(72); root_child0.setHeight(72); root_child0.setMargin(Edge.Left, "auto"); root_child0.setMargin(Edge.Right, 10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(52); expect(root.getComputedHeight()).toBe(52); expect(root_child0.getComputedLeft()).toBe(-30); expect(root_child0.getComputedTop()).toBe(-10); expect(root_child0.getComputedWidth()).toBe(72); expect(root_child0.getComputedHeight()).toBe(72); }); test('margin_auto_top_stretching_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Edge.Top, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_left_stretching_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Edge.Left, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(200); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); }); test('margin_auto_overflowing_container', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(150); root_child0.setMargin(Edge.Bottom, "auto"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(150); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(150); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(150); expect(root_child1.getComputedLeft()).toBe(75); expect(root_child1.getComputedTop()).toBe(150); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(150); }); ================================================ FILE: javascript/tests/generated/YGMinMaxDimensionTest.test.ts ================================================ /** * 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<<3129371b8f89a7343860ea2b7714b7eb>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGMinMaxDimensionTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setMaxWidth(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(10); }); test('max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setMaxHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(50); }); test.skip('min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMinHeight(60); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(60); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(40); }); test.skip('min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMinWidth(60); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(60); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(100); }); test('justify_content_min_max', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxHeight(200); root.setMinHeight(100); root.setWidth(100); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(60); root_child0.setHeight(60); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); }); test('align_items_min_max', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxWidth(200); root.setMinWidth(100); root.setHeight(100); root.setAlignItems(Align.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(60); root_child0.setHeight(60); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); }); test('justify_content_overflow_min_max', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(100); root.setMaxHeight(110); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(110); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-20); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(50); expect(root.getComputedHeight()).toBe(110); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(-20); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(30); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(50); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(80); expect(root_child2.getComputedWidth()).toBe(50); expect(root_child2.getComputedHeight()).toBe(50); }); test('flex_grow_to_min', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(100); root.setMaxHeight(500); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); }); test('flex_grow_in_at_most_container', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexBasis(0); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(0); expect(root_child0_child0.getComputedHeight()).toBe(0); }); test('flex_grow_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setFlexGrow(1); root_child0.setFlexBasis(0); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(100); }); test('flex_grow_within_constrained_min_max_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(100); root.setMaxHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(50); }); test('flex_grow_within_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxWidth(100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(20); root_child0_child0.setFlexGrow(1); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(20); }); test('flex_grow_within_constrained_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(FlexDirection.Row); root_child0.setMaxWidth(300); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(20); root_child0_child0.setFlexGrow(1); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(20); }); test('flex_root_ignored', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setMinHeight(100); root.setMaxHeight(500); root.setFlexGrow(1); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(200); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(200); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_grow_root_minimized', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setMinHeight(100); root.setMaxHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setMinHeight(100); root_child0.setMaxHeight(500); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexBasis(200); root_child0_child0.setFlexGrow(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(200); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(300); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(300); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(200); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(100); }); test('flex_grow_height_maximized', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(500); const root_child0 = Yoga.Node.create(config); root_child0.setMinHeight(100); root_child0.setMaxHeight(500); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexBasis(200); root_child0_child0.setFlexGrow(1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(400); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(400); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(400); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(400); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(100); }); test('flex_grow_within_constrained_min_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(50); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(50); expect(root_child1.getComputedHeight()).toBe(100); }); test('flex_grow_within_constrained_min_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(0); expect(root_child1.getComputedHeight()).toBe(50); }); test('flex_grow_within_constrained_max_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setMaxWidth(100); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis(100); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child1.getComputedHeight()).toBe(100); }); test('flex_grow_within_constrained_max_column', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setFlexBasis(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(50); }); test('child_min_max_width_flexing', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(120); root.setHeight(50); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth(60); root_child0.setFlexGrow(1); root_child0.setFlexBasis(0); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setMaxWidth(20); root_child1.setFlexGrow(1); root_child1.setFlexBasis("50%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(120); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(120); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(20); expect(root_child1.getComputedHeight()).toBe(50); }); test('min_width_overrides_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(100); root.setWidth(50); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(0); }); test('max_width_overrides_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxWidth(100); root.setWidth(200); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(0); }); test('min_height_overrides_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinHeight(100); root.setHeight(50); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); }); test('max_height_overrides_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxHeight(100); root.setHeight(200); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(100); }); test('min_max_percent_no_width_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth("10%"); root_child0.setMaxWidth("10%"); root_child0.setMinHeight("10%"); root_child0.setMaxHeight("10%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); ================================================ FILE: javascript/tests/generated/YGPaddingTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGPaddingTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('padding_no_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setPadding(Edge.All, 10); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(20); expect(root.getComputedHeight()).toBe(20); }); test('padding_container_match_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setPadding(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(30); expect(root.getComputedHeight()).toBe(30); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('padding_flex_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(80); }); test('padding_stretch_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.All, 10); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(10); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(80); expect(root_child0.getComputedHeight()).toBe(10); }); test('padding_center_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setPadding(Edge.Start, 10); root.setPadding(Edge.End, 20); root.setPadding(Edge.Bottom, 20); root.setAlignItems(Align.Center); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(35); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(35); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('child_with_padding_align_end', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setJustifyContent(Justify.FlexEnd); root.setAlignItems(Align.FlexEnd); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setPadding(Edge.All, 20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(100); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(100); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); }); test('physical_and_relative_edge_defined', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setPadding(Edge.Left, 20); root.setPadding(Edge.End, 50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("100%"); root_child0.setHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(130); expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(150); expect(root_child0.getComputedHeight()).toBe(50); }); ================================================ FILE: javascript/tests/generated/YGPercentageTest.test.ts ================================================ /** * 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<<3fc7c70c4c88b411b1d9dbaf7572284a>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGPercentageTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('percentage_width_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("30%"); root_child0.setHeight("30%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(140); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(60); }); test('percentage_position_left_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(400); root.setHeight(400); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("45%"); root_child0.setHeight("55%"); root_child0.setPosition(Edge.Left, "10%"); root_child0.setPosition(Edge.Top, "20%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(40); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(180); expect(root_child0.getComputedHeight()).toBe(220); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(260); expect(root_child0.getComputedTop()).toBe(80); expect(root_child0.getComputedWidth()).toBe(180); expect(root_child0.getComputedHeight()).toBe(220); }); test('percentage_position_bottom_right', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(500); root.setHeight(500); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("55%"); root_child0.setHeight("15%"); root_child0.setPosition(Edge.Bottom, "10%"); root_child0.setPosition(Edge.Right, "20%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(-100); expect(root_child0.getComputedTop()).toBe(-50); expect(root_child0.getComputedWidth()).toBe(275); expect(root_child0.getComputedHeight()).toBe(75); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(500); expect(root.getComputedHeight()).toBe(500); expect(root_child0.getComputedLeft()).toBe(125); expect(root_child0.getComputedTop()).toBe(-50); expect(root_child0.getComputedWidth()).toBe(275); expect(root_child0.getComputedHeight()).toBe(75); }); test('percentage_flex_basis', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("50%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexBasis("25%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(125); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(125); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(75); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(75); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(125); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(75); expect(root_child1.getComputedHeight()).toBe(200); }); test('percentage_flex_basis_cross', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("50%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexBasis("25%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(125); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(125); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(75); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(125); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(125); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(75); }); test.skip('percentage_flex_basis_cross_min_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMinHeight("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(2); root_child1.setMinHeight("10%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(120); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(120); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(80); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(120); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(120); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(80); }); test('percentage_flex_basis_main_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMaxHeight("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMaxHeight("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(52); expect(root_child0.getComputedHeight()).toBe(120); expect(root_child1.getComputedLeft()).toBe(52); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(148); expect(root_child1.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(148); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(52); expect(root_child0.getComputedHeight()).toBe(120); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(148); expect(root_child1.getComputedHeight()).toBe(40); }); test('percentage_flex_basis_cross_max_height', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMaxHeight("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMaxHeight("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(120); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(120); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(40); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(120); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(120); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(40); }); test('percentage_flex_basis_main_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("15%"); root_child0.setMaxWidth("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMaxWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(120); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(120); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(120); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(40); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(200); }); test('percentage_flex_basis_cross_max_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMaxWidth("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("15%"); root_child1.setMaxWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(120); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(150); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(120); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(160); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(40); expect(root_child1.getComputedHeight()).toBe(150); }); test('percentage_flex_basis_main_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("15%"); root_child0.setMinWidth("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMinWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(120); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(120); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(80); expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(80); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(120); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(80); expect(root_child1.getComputedHeight()).toBe(200); }); test('percentage_flex_basis_cross_min_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMinWidth("60%"); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("15%"); root_child1.setMinWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(150); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(50); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(150); }); test('percentage_multiple_nested_with_padding_margin_and_percentage_values', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(200); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMinWidth("60%"); root_child0.setMargin(Edge.All, 5); root_child0.setPadding(Edge.All, 3); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("50%"); root_child0_child0.setMargin(Edge.All, 5); root_child0_child0.setPadding(Edge.All, "3%"); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth("45%"); root_child0_child0_child0.setMargin(Edge.All, "5%"); root_child0_child0_child0.setPadding(Edge.All, 3); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("15%"); root_child1.setMinWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(190); expect(root_child0.getComputedHeight()).toBe(48); expect(root_child0_child0.getComputedLeft()).toBe(8); expect(root_child0_child0.getComputedTop()).toBe(8); expect(root_child0_child0.getComputedWidth()).toBe(92); expect(root_child0_child0.getComputedHeight()).toBe(25); expect(root_child0_child0_child0.getComputedLeft()).toBe(10); expect(root_child0_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0_child0.getComputedWidth()).toBe(36); expect(root_child0_child0_child0.getComputedHeight()).toBe(6); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(58); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(142); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(5); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(190); expect(root_child0.getComputedHeight()).toBe(48); expect(root_child0_child0.getComputedLeft()).toBe(90); expect(root_child0_child0.getComputedTop()).toBe(8); expect(root_child0_child0.getComputedWidth()).toBe(92); expect(root_child0_child0.getComputedHeight()).toBe(25); expect(root_child0_child0_child0.getComputedLeft()).toBe(46); expect(root_child0_child0_child0.getComputedTop()).toBe(10); expect(root_child0_child0_child0.getComputedWidth()).toBe(36); expect(root_child0_child0_child0.getComputedHeight()).toBe(6); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(58); expect(root_child1.getComputedWidth()).toBe(200); expect(root_child1.getComputedHeight()).toBe(142); }); test('percentage_margin_should_calculate_based_only_on_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Edge.All, "10%"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(160); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(20); expect(root_child0.getComputedTop()).toBe(20); expect(root_child0.getComputedWidth()).toBe(160); expect(root_child0.getComputedHeight()).toBe(60); expect(root_child0_child0.getComputedLeft()).toBe(150); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); }); test('percentage_padding_should_calculate_based_only_on_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setPadding(Edge.All, "10%"); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(20); expect(root_child0_child0.getComputedTop()).toBe(20); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(170); expect(root_child0_child0.getComputedTop()).toBe(20); expect(root_child0_child0.getComputedWidth()).toBe(10); expect(root_child0_child0.getComputedHeight()).toBe(10); }); test('percentage_absolute_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(200); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(PositionType.Absolute); root_child0.setPosition(Edge.Top, "10%"); root_child0.setPosition(Edge.Left, "30%"); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(60); expect(root_child0.getComputedTop()).toBe(10); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(10); }); test('percentage_width_height_undefined_parent_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight("50%"); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(0); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(0); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(0); }); test('percent_within_flex_grow', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setWidth(350); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth("100%"); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(350); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(150); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(150); expect(root_child1_child0.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(250); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(350); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(250); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(100); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(150); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(150); expect(root_child1_child0.getComputedHeight()).toBe(0); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(100); }); test('percentage_container_in_wrapping_container', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setAlignItems(Align.Center); root.setWidth(200); root.setHeight(200); root.setJustifyContent(Justify.Center); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(FlexDirection.Row); root_child0_child0.setJustifyContent(Justify.Center); root_child0_child0.setWidth("100%"); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setHeight(50); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth(50); root_child0_child0_child1.setHeight(50); root_child0_child0.insertChild(root_child0_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(50); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child0_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(75); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child0_child1.getComputedWidth()).toBe(50); expect(root_child0_child0_child1.getComputedHeight()).toBe(50); }); test('percent_absolute_position', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root_child0.setWidth("100%"); root_child0.setPosition(Edge.Left, "50%"); root_child0.setPositionType(PositionType.Absolute); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("100%"); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("100%"); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(60); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(60); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(60); expect(root_child0_child1.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(60); expect(root_child0.getComputedHeight()).toBe(50); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(60); expect(root_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(-60); expect(root_child0_child1.getComputedTop()).toBe(0); expect(root_child0_child1.getComputedWidth()).toBe(60); expect(root_child0_child1.getComputedHeight()).toBe(50); }); test('percent_of_minmax_main', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMinWidth(60); root.setMaxWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); }); test.skip('percent_of_min_main', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMinWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); }); test.skip('percent_of_min_main_multiple', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMinWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth("50%"); root_child1.setHeight(20); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setWidth("50%"); root_child2.setHeight(20); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(30); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(60); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(30); expect(root_child1.getComputedHeight()).toBe(20); expect(root_child2.getComputedLeft()).toBe(-30); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(30); expect(root_child2.getComputedHeight()).toBe(20); }); test.skip('percent_of_max_main', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setFlexDirection(FlexDirection.Row); root.setMaxWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(20); }); test('percent_of_minmax_cross_stretched', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(60); root.setMaxWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); }); test('percent_absolute_of_minmax_cross_stretched', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(60); root.setMaxWidth(60); root.setHeight(50); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root_child0.setPositionType(PositionType.Absolute); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); }); test('percent_of_minmax_cross_unstretched', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(60); root.setMaxWidth(60); root.setHeight(50); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); }); test.skip('percent_of_min_cross_unstretched', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMinWidth(60); root.setHeight(50); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(60); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(30); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(30); expect(root_child0.getComputedHeight()).toBe(20); }); test('percent_of_max_cross_unstretched', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setMaxWidth(60); root.setHeight(50); root.setAlignItems(Align.FlexStart); const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(0); expect(root.getComputedHeight()).toBe(50); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(0); expect(root_child0.getComputedHeight()).toBe(20); }); ================================================ FILE: javascript/tests/generated/YGRoundingTest.test.ts ================================================ /** * 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<> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGRoundingTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('rounding_flex_basis_flex_grow_row_width_of_100', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(33); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(33); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(34); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(67); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(33); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(67); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(33); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(33); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(34); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(33); expect(root_child2.getComputedHeight()).toBe(100); }); test('rounding_flex_basis_flex_grow_row_prime_number_width', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(113); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); const root_child3 = Yoga.Node.create(config); root_child3.setFlexGrow(1); root.insertChild(root_child3, 3); const root_child4 = Yoga.Node.create(config); root_child4.setFlexGrow(1); root.insertChild(root_child4, 4); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(113); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(23); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(23); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(22); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(45); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(23); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(68); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(22); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(90); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(23); expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(113); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(90); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(23); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(68); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(22); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(45); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(23); expect(root_child2.getComputedHeight()).toBe(100); expect(root_child3.getComputedLeft()).toBe(23); expect(root_child3.getComputedTop()).toBe(0); expect(root_child3.getComputedWidth()).toBe(22); expect(root_child3.getComputedHeight()).toBe(100); expect(root_child4.getComputedLeft()).toBe(0); expect(root_child4.getComputedTop()).toBe(0); expect(root_child4.getComputedWidth()).toBe(23); expect(root_child4.getComputedHeight()).toBe(100); }); test('rounding_flex_basis_flex_shrink_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(101); root.setHeight(100); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(100); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(25); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setFlexBasis(25); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(101); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(51); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(51); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(76); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(101); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(50); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(51); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child1.getComputedLeft()).toBe(25); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(25); expect(root_child1.getComputedHeight()).toBe(100); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(25); expect(root_child2.getComputedHeight()).toBe(100); }); test('rounding_flex_basis_overrides_main_size', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(113); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(64); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(64); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(24); }); test('rounding_total_fractial', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(113.4); root.setWidth(87.4); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20.3); root_child0.setFlexGrow(0.7); root_child0.setFlexBasis(50.3); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1.6); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10.7); root_child2.setFlexGrow(1.1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(87); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(87); expect(root_child0.getComputedHeight()).toBe(59); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(59); expect(root_child1.getComputedWidth()).toBe(87); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(87); expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(87); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(87); expect(root_child0.getComputedHeight()).toBe(59); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(59); expect(root_child1.getComputedWidth()).toBe(87); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(87); expect(root_child2.getComputedHeight()).toBe(24); }); test('rounding_total_fractial_nested', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(113.4); root.setWidth(87.4); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20.3); root_child0.setFlexGrow(0.7); root_child0.setFlexBasis(50.3); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPosition(Edge.Bottom, 13.3); root_child0_child0.setHeight(9.9); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexBasis(0.3); root_child0.insertChild(root_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setPosition(Edge.Top, 13.3); root_child0_child1.setHeight(1.1); root_child0_child1.setFlexGrow(4); root_child0_child1.setFlexBasis(0.3); root_child0.insertChild(root_child0_child1, 1); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1.6); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10.7); root_child2.setFlexGrow(1.1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(87); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(87); expect(root_child0.getComputedHeight()).toBe(59); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(-13); expect(root_child0_child0.getComputedWidth()).toBe(87); expect(root_child0_child0.getComputedHeight()).toBe(12); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(25); expect(root_child0_child1.getComputedWidth()).toBe(87); expect(root_child0_child1.getComputedHeight()).toBe(47); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(59); expect(root_child1.getComputedWidth()).toBe(87); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(87); expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(87); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(87); expect(root_child0.getComputedHeight()).toBe(59); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(-13); expect(root_child0_child0.getComputedWidth()).toBe(87); expect(root_child0_child0.getComputedHeight()).toBe(12); expect(root_child0_child1.getComputedLeft()).toBe(0); expect(root_child0_child1.getComputedTop()).toBe(25); expect(root_child0_child1.getComputedWidth()).toBe(87); expect(root_child0_child1.getComputedHeight()).toBe(47); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(59); expect(root_child1.getComputedWidth()).toBe(87); expect(root_child1.getComputedHeight()).toBe(30); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(87); expect(root_child2.getComputedHeight()).toBe(24); }); test('rounding_fractial_input_1', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(113.4); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(64); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(64); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(24); }); test('rounding_fractial_input_2', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(113.6); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(114); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(65); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(24); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(114); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(65); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(24); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(25); }); test('rounding_fractial_input_3', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setPosition(Edge.Top, 0.3); root.setHeight(113.4); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(114); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(24); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(114); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(65); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(24); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(25); }); test('rounding_fractial_input_4', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setPosition(Edge.Top, 0.7); root.setHeight(113.4); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(20); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(1); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(64); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(1); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(113); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(64); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(64); expect(root_child1.getComputedWidth()).toBe(100); expect(root_child1.getComputedHeight()).toBe(25); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(89); expect(root_child2.getComputedWidth()).toBe(100); expect(root_child2.getComputedHeight()).toBe(24); }); test('rounding_inner_node_controversy_horizontal', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(320); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setHeight(10); root_child1_child0.setFlexGrow(1); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(107); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(107); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(106); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(106); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(213); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(107); expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(320); expect(root.getComputedHeight()).toBe(10); expect(root_child0.getComputedLeft()).toBe(213); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(107); expect(root_child0.getComputedHeight()).toBe(10); expect(root_child1.getComputedLeft()).toBe(107); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(106); expect(root_child1.getComputedHeight()).toBe(10); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(106); expect(root_child1_child0.getComputedHeight()).toBe(10); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(107); expect(root_child2.getComputedHeight()).toBe(10); }); test('rounding_inner_node_controversy_vertical', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(320); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(10); root_child1_child0.setFlexGrow(1); root_child1.insertChild(root_child1_child0, 0); const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(10); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(107); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(107); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(106); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(10); expect(root_child1_child0.getComputedHeight()).toBe(106); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(107); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(10); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(10); expect(root_child0.getComputedHeight()).toBe(107); expect(root_child1.getComputedLeft()).toBe(0); expect(root_child1.getComputedTop()).toBe(107); expect(root_child1.getComputedWidth()).toBe(10); expect(root_child1.getComputedHeight()).toBe(106); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(10); expect(root_child1_child0.getComputedHeight()).toBe(106); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(213); expect(root_child2.getComputedWidth()).toBe(10); expect(root_child2.getComputedHeight()).toBe(107); }); test('rounding_inner_node_controversy_combined', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(640); root.setHeight(320); root.setFlexDirection(FlexDirection.Row); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("100%"); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); const root_child1 = Yoga.Node.create(config); root_child1.setHeight("100%"); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth("100%"); root_child1_child0.setFlexGrow(1); root_child1.insertChild(root_child1_child0, 0); const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setWidth("100%"); root_child1_child1.setFlexGrow(1); root_child1.insertChild(root_child1_child1, 1); const root_child1_child1_child0 = Yoga.Node.create(config); root_child1_child1_child0.setFlexGrow(1); root_child1_child1_child0.setWidth("100%"); root_child1_child1.insertChild(root_child1_child1_child0, 0); const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth("100%"); root_child1_child2.setFlexGrow(1); root_child1.insertChild(root_child1_child2, 2); const root_child2 = Yoga.Node.create(config); root_child2.setHeight("100%"); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(640); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(213); expect(root_child0.getComputedHeight()).toBe(320); expect(root_child1.getComputedLeft()).toBe(213); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(214); expect(root_child1.getComputedHeight()).toBe(320); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(214); expect(root_child1_child0.getComputedHeight()).toBe(107); expect(root_child1_child1.getComputedLeft()).toBe(0); expect(root_child1_child1.getComputedTop()).toBe(107); expect(root_child1_child1.getComputedWidth()).toBe(214); expect(root_child1_child1.getComputedHeight()).toBe(106); expect(root_child1_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child1_child0.getComputedWidth()).toBe(214); expect(root_child1_child1_child0.getComputedHeight()).toBe(106); expect(root_child1_child2.getComputedLeft()).toBe(0); expect(root_child1_child2.getComputedTop()).toBe(213); expect(root_child1_child2.getComputedWidth()).toBe(214); expect(root_child1_child2.getComputedHeight()).toBe(107); expect(root_child2.getComputedLeft()).toBe(427); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(213); expect(root_child2.getComputedHeight()).toBe(320); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(640); expect(root.getComputedHeight()).toBe(320); expect(root_child0.getComputedLeft()).toBe(427); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(213); expect(root_child0.getComputedHeight()).toBe(320); expect(root_child1.getComputedLeft()).toBe(213); expect(root_child1.getComputedTop()).toBe(0); expect(root_child1.getComputedWidth()).toBe(214); expect(root_child1.getComputedHeight()).toBe(320); expect(root_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child0.getComputedWidth()).toBe(214); expect(root_child1_child0.getComputedHeight()).toBe(107); expect(root_child1_child1.getComputedLeft()).toBe(0); expect(root_child1_child1.getComputedTop()).toBe(107); expect(root_child1_child1.getComputedWidth()).toBe(214); expect(root_child1_child1.getComputedHeight()).toBe(106); expect(root_child1_child1_child0.getComputedLeft()).toBe(0); expect(root_child1_child1_child0.getComputedTop()).toBe(0); expect(root_child1_child1_child0.getComputedWidth()).toBe(214); expect(root_child1_child1_child0.getComputedHeight()).toBe(106); expect(root_child1_child2.getComputedLeft()).toBe(0); expect(root_child1_child2.getComputedTop()).toBe(213); expect(root_child1_child2.getComputedWidth()).toBe(214); expect(root_child1_child2.getComputedHeight()).toBe(107); expect(root_child2.getComputedLeft()).toBe(0); expect(root_child2.getComputedTop()).toBe(0); expect(root_child2.getComputedWidth()).toBe(213); expect(root_child2.getComputedHeight()).toBe(320); }); ================================================ FILE: javascript/tests/generated/YGSizeOverflowTest.test.ts ================================================ /** * 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<<09381d1f2a9ade99b83e83ae80d9b1fb>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGSizeOverflowTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('nested_overflowing_child', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(-100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); }); test('nested_overflowing_child_in_constraint_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setHeight(100); root.setWidth(100); const root_child0 = Yoga.Node.create(config); root_child0.setHeight(100); root_child0.setWidth(100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); expect(root_child0_child0.getComputedLeft()).toBe(-100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); }); test('parent_wrap_child_size_overflowing_parent', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); root.setWidth(100); root.setHeight(100); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0_child0.setHeight(200); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(200); }); ================================================ FILE: javascript/tests/generated/YGStaticPositionTest.test.ts ================================================ /** * 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<<3e2e54bdc4960c437415132dafa7d211>> * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGStaticPositionTest.html */ import { instrinsicSizeMeasureFunc } from '../tools/utils.ts' import Yoga from 'yoga-layout'; import { Align, BoxSizing, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, MeasureMode, Overflow, PositionType, Unit, Wrap, } from 'yoga-layout'; test('static_position_insets_have_no_effect_left_top', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setPositionType(PositionType.Static); root_child0.setPosition(Edge.Top, 50); root_child0.setPosition(Edge.Left, 50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); }); test('static_position_insets_have_no_effect_right_bottom', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root_child0.setPositionType(PositionType.Static); root_child0.setPosition(Edge.Bottom, 50); root_child0.setPosition(Edge.Right, 50); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(100); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(100); expect(root_child0.getComputedHeight()).toBe(100); }); test('static_position_absolute_child_insets_relative_to_positioned_ancestor', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setMargin(Edge.Left, 100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Left, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_insets_relative_to_positioned_ancestor_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Left, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_row_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setFlexDirection(FlexDirection.RowReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setFlexDirection(FlexDirection.ColumnReverse); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Left, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_insets_relative_to_positioned_ancestor_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Right, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_row', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setFlexDirection(FlexDirection.Row); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setFlexDirection(FlexDirection.ColumnReverse); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Right, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_insets_relative_to_positioned_ancestor_column_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Right, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_column_reverse', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root_child0.setFlexDirection(FlexDirection.ColumnReverse); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setFlexDirection(FlexDirection.ColumnReverse); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0.setPosition(Edge.Right, 50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_insets_relative_to_positioned_ancestor_deep', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setMargin(Edge.Left, 100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(100); root_child0_child0_child0.setWidth(100); root_child0_child0_child0.setMargin(Edge.Left, 100); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setHeight(100); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setMargin(Edge.Left, 100); root_child0_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child0.setHeight(100); root_child0_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0_child0.setMargin(Edge.Left, 100); root_child0_child0_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0, 0); const root_child0_child0_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0_child0_child0.setWidth(50); root_child0_child0_child0_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0_child0_child0_child0.setPosition(Edge.Top, 50); root_child0_child0_child0_child0_child0_child0.setPosition(Edge.Left, 50); root_child0_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(-350); expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_width_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_width_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_width_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_height_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("50%"); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); }); test('static_position_relative_child_height_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("50%"); root_child0_child0_child0.setWidth(50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_height_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("50%"); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_left_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Left, "50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_left_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Left, "50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_left_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Left, "50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_right_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Right, "50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_right_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Right, "50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_right_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Right, "50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_top_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Top, "50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_top_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Top, "50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_top_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Top, "50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_bottom_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Bottom, "50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_bottom_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Bottom, "50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(-50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_bottom_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPosition(Edge.Bottom, "50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_margin_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setMargin(Edge.All, "50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-50); expect(root_child0_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_margin_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setMargin(Edge.All, "50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_margin_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setMargin(Edge.All, "50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(50); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_padding_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPadding(Edge.All, "50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(200); }); test('static_position_relative_child_padding_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPadding(Edge.All, "50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); }); test('static_position_static_child_padding_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPadding(Edge.All, "50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0.getComputedHeight()).toBe(100); }); test('static_position_absolute_child_border_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_border_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_border_percentage', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(200); root_child0.setHeight(200); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(200); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(200); expect(root_child0.getComputedHeight()).toBe(200); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_containing_block_padding_box', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("50%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(200); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-100); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_containing_block_padding_box', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("50%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(200); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_containing_block_padding_box', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("50%"); root_child0_child0_child0.setPositionType(PositionType.Static); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(200); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(50); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(50); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_absolute_child_containing_block_content_box', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(50); root_child0_child0.setWidth("50%"); root_child0_child0.setPositionType(PositionType.Absolute); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_relative_child_containing_block_content_box', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(50); root_child0_child0.setWidth("50%"); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(200); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_static_child_containing_block_content_box', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(50); root_child0_child0.setWidth("50%"); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(200); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_containing_block_padding_and_border', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.Top, 8); root_child0.setPadding(Edge.Right, 1); root_child0.setPadding(Edge.Bottom, 4); root_child0.setPadding(Edge.Left, 9); root_child0.setBorder(Edge.Top, 5); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 4); root_child0.setBorder(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("61%"); root_child0_child0_child0.setWidth("41%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(11); expect(root_child0_child0.getComputedTop()).toBe(13); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0_child0.getComputedHeight()).toBe(239); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(292); expect(root_child0_child0.getComputedTop()).toBe(13); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(-60); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(160); expect(root_child0_child0_child0.getComputedHeight()).toBe(239); }); test('static_position_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(500); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("63%"); root_child0_child0_child0.setWidth("41%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Left, 2); root_child0_child0_child0.setPosition(Edge.Right, 12); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(1); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(279); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(-2); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); }); test('static_position_no_position_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(500); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("63%"); root_child0_child0_child0.setWidth("41%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(279); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(-15); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); }); test('static_position_zero_for_inset_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(500); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("63%"); root_child0_child0_child0.setWidth("41%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Left, "0%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(-1); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(279); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(-265); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); }); test('static_position_start_inset_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(500); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("63%"); root_child0_child0_child0.setWidth("41%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Start, 12); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(11); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(279); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(-2); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); }); test('static_position_end_inset_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(500); root_child0.setHeight(500); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(200); root_child0_child0.setWidth(200); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight("63%"); root_child0_child0_child0.setWidth("41%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.End, 4); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(270); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(513); expect(root.getComputedHeight()).toBe(506); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(500); expect(root_child0.getComputedHeight()).toBe(500); expect(root_child0_child0.getComputedLeft()).toBe(279); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0.getComputedHeight()).toBe(200); expect(root_child0_child0_child0.getComputedLeft()).toBe(-261); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(200); expect(root_child0_child0_child0.getComputedHeight()).toBe(306); }); test('static_position_row_reverse_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setFlexDirection(FlexDirection.RowReverse); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setHeight("12%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(-128); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(133); expect(root_child0_child0_child0.getComputedHeight()).toBe(23); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(133); expect(root_child0_child0_child0.getComputedHeight()).toBe(23); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_column_reverse_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setFlexDirection(FlexDirection.ColumnReverse); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(-82); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(-15); expect(root_child0_child0_child0.getComputedTop()).toBe(-82); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_justify_flex_start_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(18); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(18); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(111); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(131); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(131); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_justify_flex_start_position_set_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setPosition(Edge.Right, 30); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(106); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(18); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(18); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(106); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(131); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(131); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_no_definite_size_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Left, "23%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(133); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(133); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_both_insets_set_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setPosition(Edge.Left, "23%"); root_child0_child0_child0.setPosition(Edge.Right, 13); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(9); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(69); expect(root.getComputedHeight()).toBe(79); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(56); expect(root_child0.getComputedHeight()).toBe(73); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0.getComputedHeight()).toBe(22); expect(root_child0_child0_child0.getComputedLeft()).toBe(-3); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(20); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); }); test('static_position_justify_center_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setJustifyContent(Justify.Center); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(85); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(18); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(18); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(111); expect(root_child0_child0_child0.getComputedTop()).toBe(85); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(131); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(131); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_justify_flex_end_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setJustifyContent(Justify.FlexEnd); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(140); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(18); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(18); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(111); expect(root_child0_child0_child0.getComputedTop()).toBe(140); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(131); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(131); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_align_flex_start_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setAlignItems(Align.FlexStart); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(18); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(18); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(111); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(131); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(131); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_align_center_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setAlignItems(Align.Center); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(65); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(39); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(75); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(75); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(65); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(39); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(75); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(75); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_align_flex_end_amalgamation', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Edge.Top, 5); root_child0.setMargin(Edge.Right, 9); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 4); root_child0.setBorder(Edge.Top, 6); root_child0.setBorder(Edge.Right, 7); root_child0.setBorder(Edge.Bottom, 8); root_child0.setBorder(Edge.Left, 5); root_child0.setPadding(Edge.Top, 9); root_child0.setPadding(Edge.Right, 11); root_child0.setPadding(Edge.Bottom, 13); root_child0.setPadding(Edge.Left, 2); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setPositionType(PositionType.Static); root_child0_child0.setMargin(Edge.Top, 6); root_child0_child0.setMargin(Edge.Right, 3); root_child0_child0.setMargin(Edge.Bottom, 9); root_child0_child0.setMargin(Edge.Left, 8); root_child0_child0.setBorder(Edge.Top, 10); root_child0_child0.setBorder(Edge.Right, 2); root_child0_child0.setBorder(Edge.Bottom, 1); root_child0_child0.setBorder(Edge.Left, 8); root_child0_child0.setPadding(Edge.Top, 7); root_child0_child0.setPadding(Edge.Right, 9); root_child0_child0.setPadding(Edge.Bottom, 4); root_child0_child0.setPadding(Edge.Left, 1); root_child0_child0.setAlignItems(Align.FlexEnd); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0_child0.setWidth("21%"); root_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setWidth(100); root_child0_child0_child0_child0.setHeight(50); root_child0_child0_child0_child0.setMargin(Edge.Top, 12); root_child0_child0_child0_child0.setMargin(Edge.Right, 4); root_child0_child0_child0_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child0_child0.setMargin(Edge.Left, 9); root_child0_child0_child0_child0.setBorder(Edge.Top, 1); root_child0_child0_child0_child0.setBorder(Edge.Right, 5); root_child0_child0_child0_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child0_child0.setBorder(Edge.Left, 2); root_child0_child0_child0_child0.setPadding(Edge.Top, 3); root_child0_child0_child0_child0.setPadding(Edge.Right, 8); root_child0_child0_child0_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child0_child0.setPadding(Edge.Left, 5); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth("10%"); root_child0_child0_child1.setMargin(Edge.Top, 12); root_child0_child0_child1.setMargin(Edge.Right, 4); root_child0_child0_child1.setMargin(Edge.Bottom, 7); root_child0_child0_child1.setMargin(Edge.Left, 9); root_child0_child0_child1.setBorder(Edge.Top, 1); root_child0_child0_child1.setBorder(Edge.Right, 5); root_child0_child0_child1.setBorder(Edge.Bottom, 9); root_child0_child0_child1.setBorder(Edge.Left, 2); root_child0_child0_child1.setPadding(Edge.Top, 3); root_child0_child0_child1.setPadding(Edge.Right, 8); root_child0_child0_child1.setPadding(Edge.Bottom, 10); root_child0_child0_child1.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child1, 1); const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setWidth(100); root_child0_child0_child1_child0.setHeight(50); root_child0_child0_child1_child0.setMargin(Edge.Top, 12); root_child0_child0_child1_child0.setMargin(Edge.Right, 4); root_child0_child0_child1_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child1_child0.setMargin(Edge.Left, 9); root_child0_child0_child1_child0.setBorder(Edge.Top, 1); root_child0_child0_child1_child0.setBorder(Edge.Right, 5); root_child0_child0_child1_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child1_child0.setBorder(Edge.Left, 2); root_child0_child0_child1_child0.setPadding(Edge.Top, 3); root_child0_child0_child1_child0.setPadding(Edge.Right, 8); root_child0_child0_child1_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child1_child0.setPadding(Edge.Left, 5); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); const root_child0_child0_child2 = Yoga.Node.create(config); root_child0_child0_child2.setWidth("10%"); root_child0_child0_child2.setMargin(Edge.Top, 12); root_child0_child0_child2.setMargin(Edge.Right, 4); root_child0_child0_child2.setMargin(Edge.Bottom, 7); root_child0_child0_child2.setMargin(Edge.Left, 9); root_child0_child0_child2.setBorder(Edge.Top, 1); root_child0_child0_child2.setBorder(Edge.Right, 5); root_child0_child0_child2.setBorder(Edge.Bottom, 9); root_child0_child0_child2.setBorder(Edge.Left, 2); root_child0_child0_child2.setPadding(Edge.Top, 3); root_child0_child0_child2.setPadding(Edge.Right, 8); root_child0_child0_child2.setPadding(Edge.Bottom, 10); root_child0_child0_child2.setPadding(Edge.Left, 5); root_child0_child0.insertChild(root_child0_child0_child2, 2); const root_child0_child0_child2_child0 = Yoga.Node.create(config); root_child0_child0_child2_child0.setWidth(100); root_child0_child0_child2_child0.setHeight(50); root_child0_child0_child2_child0.setMargin(Edge.Top, 12); root_child0_child0_child2_child0.setMargin(Edge.Right, 4); root_child0_child0_child2_child0.setMargin(Edge.Bottom, 7); root_child0_child0_child2_child0.setMargin(Edge.Left, 9); root_child0_child0_child2_child0.setBorder(Edge.Top, 1); root_child0_child0_child2_child0.setBorder(Edge.Right, 5); root_child0_child0_child2_child0.setBorder(Edge.Bottom, 9); root_child0_child0_child2_child0.setBorder(Edge.Left, 2); root_child0_child0_child2_child0.setPadding(Edge.Top, 3); root_child0_child0_child2_child0.setPadding(Edge.Right, 8); root_child0_child0_child2_child0.setPadding(Edge.Bottom, 10); root_child0_child0_child2_child0.setPadding(Edge.Left, 5); root_child0_child0_child2.insertChild(root_child0_child0_child2_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(111); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(131); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(131); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(16); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(215); expect(root.getComputedHeight()).toBe(301); expect(root_child0.getComputedLeft()).toBe(4); expect(root_child0.getComputedTop()).toBe(5); expect(root_child0.getComputedWidth()).toBe(202); expect(root_child0.getComputedHeight()).toBe(295); expect(root_child0_child0.getComputedLeft()).toBe(15); expect(root_child0_child0.getComputedTop()).toBe(21); expect(root_child0_child0.getComputedWidth()).toBe(166); expect(root_child0_child0.getComputedHeight()).toBe(244); expect(root_child0_child0_child0.getComputedLeft()).toBe(18); expect(root_child0_child0_child0.getComputedTop()).toBe(29); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(92); expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(-77); expect(root_child0_child0_child0_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child1.getComputedLeft()).toBe(18); expect(root_child0_child0_child1.getComputedTop()).toBe(29); expect(root_child0_child0_child1.getComputedWidth()).toBe(20); expect(root_child0_child0_child1.getComputedHeight()).toBe(92); expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child1_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child0_child2.getComputedLeft()).toBe(18); expect(root_child0_child0_child2.getComputedTop()).toBe(140); expect(root_child0_child0_child2.getComputedWidth()).toBe(20); expect(root_child0_child0_child2.getComputedHeight()).toBe(92); expect(root_child0_child0_child2_child0.getComputedLeft()).toBe(-97); expect(root_child0_child0_child2_child0.getComputedTop()).toBe(16); expect(root_child0_child0_child2_child0.getComputedWidth()).toBe(100); expect(root_child0_child0_child2_child0.getComputedHeight()).toBe(50); }); test('static_position_static_root', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setHeight(200); root.setWidth(100); root.setPositionType(PositionType.Static); root.setPadding(Edge.Top, 1); root.setPadding(Edge.Right, 11); root.setPadding(Edge.Bottom, 4); root.setPadding(Edge.Left, 6); const root_child0 = Yoga.Node.create(config); root_child0.setHeight("50%"); root_child0.setWidth("50%"); root_child0.setPositionType(PositionType.Absolute); root_child0.setBorder(Edge.Top, 3); root_child0.setBorder(Edge.Right, 2); root_child0.setBorder(Edge.Bottom, 1); root_child0.setBorder(Edge.Left, 4); root_child0.setPadding(Edge.Top, 7); root_child0.setPadding(Edge.Right, 5); root_child0.setPadding(Edge.Bottom, 4); root_child0.setPadding(Edge.Left, 3); root_child0.setMargin(Edge.Top, 11); root_child0.setMargin(Edge.Right, 15); root_child0.setMargin(Edge.Bottom, 1); root_child0.setMargin(Edge.Left, 12); root.insertChild(root_child0, 0); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(18); expect(root_child0.getComputedTop()).toBe(12); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(100); expect(root.getComputedHeight()).toBe(200); expect(root_child0.getComputedLeft()).toBe(24); expect(root_child0.getComputedTop()).toBe(12); expect(root_child0.getComputedWidth()).toBe(50); expect(root_child0.getComputedHeight()).toBe(100); }); test('static_position_absolute_child_multiple', () => { const config = Yoga.Config.create(); const root = Yoga.Node.create(config); root.setPositionType(PositionType.Absolute); const root_child0 = Yoga.Node.create(config); root_child0.setWidth(400); root_child0.setHeight(400); root_child0.setPadding(Edge.All, 100); root.insertChild(root_child0, 0); const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setHeight(100); root_child0_child0.setWidth(100); root_child0_child0.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child0, 0); const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setHeight(50); root_child0_child0_child0.setWidth("10%"); root_child0_child0_child0.setPositionType(PositionType.Absolute); root_child0_child0.insertChild(root_child0_child0_child0, 0); const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setHeight(100); root_child0_child1.setWidth(100); root_child0_child1.setPositionType(PositionType.Static); root_child0.insertChild(root_child0_child1, 1); const root_child0_child1_child0 = Yoga.Node.create(config); root_child0_child1_child0.setHeight(50); root_child0_child1_child0.setWidth("50%"); root_child0_child1_child0.setPositionType(PositionType.Absolute); root_child0_child1.insertChild(root_child0_child1_child0, 0); const root_child0_child1_child1 = Yoga.Node.create(config); root_child0_child1_child1.setHeight(50); root_child0_child1_child1.setWidth("50%"); root_child0_child1_child1.setPositionType(PositionType.Absolute); root_child0_child1.insertChild(root_child0_child1_child1, 1); const root_child0_child2 = Yoga.Node.create(config); root_child0_child2.setHeight(50); root_child0_child2.setWidth(25); root_child0_child2.setPositionType(PositionType.Absolute); root_child0.insertChild(root_child0_child2, 2); root.calculateLayout(undefined, undefined, Direction.LTR); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(100); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(0); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(100); expect(root_child0_child1.getComputedTop()).toBe(200); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child1_child0.getComputedLeft()).toBe(0); expect(root_child0_child1_child0.getComputedTop()).toBe(0); expect(root_child0_child1_child0.getComputedWidth()).toBe(200); expect(root_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child1_child1.getComputedLeft()).toBe(0); expect(root_child0_child1_child1.getComputedTop()).toBe(0); expect(root_child0_child1_child1.getComputedWidth()).toBe(200); expect(root_child0_child1_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(100); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); root.calculateLayout(undefined, undefined, Direction.RTL); expect(root.getComputedLeft()).toBe(0); expect(root.getComputedTop()).toBe(0); expect(root.getComputedWidth()).toBe(400); expect(root.getComputedHeight()).toBe(400); expect(root_child0.getComputedLeft()).toBe(0); expect(root_child0.getComputedTop()).toBe(0); expect(root_child0.getComputedWidth()).toBe(400); expect(root_child0.getComputedHeight()).toBe(400); expect(root_child0_child0.getComputedLeft()).toBe(200); expect(root_child0_child0.getComputedTop()).toBe(100); expect(root_child0_child0.getComputedWidth()).toBe(100); expect(root_child0_child0.getComputedHeight()).toBe(100); expect(root_child0_child0_child0.getComputedLeft()).toBe(60); expect(root_child0_child0_child0.getComputedTop()).toBe(0); expect(root_child0_child0_child0.getComputedWidth()).toBe(40); expect(root_child0_child0_child0.getComputedHeight()).toBe(50); expect(root_child0_child1.getComputedLeft()).toBe(200); expect(root_child0_child1.getComputedTop()).toBe(200); expect(root_child0_child1.getComputedWidth()).toBe(100); expect(root_child0_child1.getComputedHeight()).toBe(100); expect(root_child0_child1_child0.getComputedLeft()).toBe(-100); expect(root_child0_child1_child0.getComputedTop()).toBe(0); expect(root_child0_child1_child0.getComputedWidth()).toBe(200); expect(root_child0_child1_child0.getComputedHeight()).toBe(50); expect(root_child0_child1_child1.getComputedLeft()).toBe(-100); expect(root_child0_child1_child1.getComputedTop()).toBe(0); expect(root_child0_child1_child1.getComputedWidth()).toBe(200); expect(root_child0_child1_child1.getComputedHeight()).toBe(50); expect(root_child0_child2.getComputedLeft()).toBe(275); expect(root_child0_child2.getComputedTop()).toBe(100); expect(root_child0_child2.getComputedWidth()).toBe(25); expect(root_child0_child2.getComputedHeight()).toBe(50); }); ================================================ FILE: javascript/tests/tools/MeasureCounter.ts ================================================ /** * 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. * * @format */ import type {MeasureFunction} from 'yoga-layout'; import Yoga from 'yoga-layout'; export type MeasureCounter = { inc: MeasureFunction; get: () => number; }; export function getMeasureCounter( cb?: MeasureFunction | null, staticWidth = 0, staticHeight = 0, ): MeasureCounter { let counter = 0; return { inc: function (width, widthMode, height, heightMode) { counter += 1; return cb ? cb(width, widthMode, height, heightMode) : {width: staticWidth, height: staticHeight}; }, get: function () { return counter; }, }; } export function getMeasureCounterMax(): MeasureCounter { return getMeasureCounter((width, widthMode, height, heightMode) => { const measuredWidth = widthMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : width; const measuredHeight = heightMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : height; return {width: measuredWidth, height: measuredHeight}; }); } export function getMeasureCounterMin(): MeasureCounter { return getMeasureCounter((width, widthMode, height, heightMode) => { const measuredWidth = widthMode === Yoga.MEASURE_MODE_UNDEFINED || (widthMode == Yoga.MEASURE_MODE_AT_MOST && width > 10) ? 10 : width; const measuredHeight = heightMode === Yoga.MEASURE_MODE_UNDEFINED || (heightMode == Yoga.MEASURE_MODE_AT_MOST && height > 10) ? 10 : height; return {width: measuredWidth, height: measuredHeight}; }); } ================================================ FILE: javascript/tests/tools/globals.ts ================================================ /** * 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. */ declare global { // eslint-disable-next-line no-var var YGBENCHMARK: (title: string, fn: () => void) => void; } if (globalThis.YGBENCHMARK === undefined) { throw new Error('Expected "YGBENCHMARK" global to be set'); } const benchmark = globalThis.YGBENCHMARK; export {benchmark as YGBENCHMARK}; ================================================ FILE: javascript/tests/tools/utils.ts ================================================ /** * 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. */ import {FlexDirection, MeasureMode} from 'yoga-layout'; type MeasureContext = { text: string; flexDirection: FlexDirection; }; export function instrinsicSizeMeasureFunc( this: MeasureContext, width: number, widthMode: MeasureMode, height: number, heightMode: MeasureMode, ): {width: number; height: number} { const textLength = this.text.length; const words = this.text.split(' '); const flexDirection = this.flexDirection; const widthPerChar = 10; const heightPerChar = 10; let measuredWidth: number; let measuredHeight: number; switch (widthMode) { case MeasureMode.Exactly: measuredWidth = width; break; case MeasureMode.AtMost: measuredWidth = Math.min(width, textLength * widthPerChar); break; default: measuredWidth = textLength * widthPerChar; } switch (heightMode) { case MeasureMode.Exactly: measuredHeight = height; break; case MeasureMode.AtMost: measuredHeight = Math.min(height, calculateHeight()); break; default: measuredHeight = calculateHeight(); } function longestWordWidth() { return Math.max(...words.map(word => word.length)) * widthPerChar; } function calculateHeight() { if (textLength * widthPerChar <= measuredWidth) { return heightPerChar; } const maxLineWidth = flexDirection == FlexDirection.Column ? measuredWidth : Math.max(longestWordWidth(), measuredWidth); //if fixed width < width of widest word, take width of widest word let lines = 1; let currentLineLength = 0; for (const word of words) { const wordWidth = word.length * widthPerChar; if (wordWidth > maxLineWidth) { if (currentLineLength > 0) { lines++; } lines++; currentLineLength = 0; } else if (currentLineLength + wordWidth <= maxLineWidth) { currentLineLength += widthPerChar + wordWidth; } else { lines++; currentLineLength = widthPerChar + wordWidth; } } return (currentLineLength === 0 ? lines - 1 : lines) * heightPerChar; } return {width: measuredWidth, height: measuredHeight}; } ================================================ FILE: javascript/tsconfig.json ================================================ { "compilerOptions": { "target": "es2020", "module": "esnext", "strict": true, "declaration": true, "esModuleInterop": true, "skipLibCheck": true, // TODO: moduleResolution: "nodenext" is buggy with this if the absolute // path contains any capital letters "forceConsistentCasingInFileNames": false, "baseUrl": ".", "moduleResolution": "nodenext", "allowImportingTsExtensions": true, "paths": { "yoga-layout": ["src"] } }, "include": [ "src/**/*", "tests/**/*" ] } ================================================ FILE: lib/jni/jni.h ================================================ /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the LICENSE * file in the root directory of this source tree. */ #pragma once #ifdef __ANDROID__ #include_next #else #include "real/jni.h" #endif ================================================ FILE: lib/jni/real/jni.h ================================================ /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JNI specification, as defined by Sun: * http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html * * Everything here is expected to be VM-neutral. */ #ifndef JNI_H_ #define JNI_H_ #include #include /* Primitive types that match up with Java equivalents. */ typedef uint8_t jboolean; /* unsigned 8 bits */ typedef int8_t jbyte; /* signed 8 bits */ typedef uint16_t jchar; /* unsigned 16 bits */ typedef int16_t jshort; /* signed 16 bits */ typedef int32_t jint; /* signed 32 bits */ typedef int64_t jlong; /* signed 64 bits */ typedef float jfloat; /* 32-bit IEEE 754 */ typedef double jdouble; /* 64-bit IEEE 754 */ /* "cardinal indices and sizes" */ typedef jint jsize; #ifdef __cplusplus /* * Reference types, in C++ */ class _jobject {}; class _jclass : public _jobject {}; class _jstring : public _jobject {}; class _jarray : public _jobject {}; class _jobjectArray : public _jarray {}; class _jbooleanArray : public _jarray {}; class _jbyteArray : public _jarray {}; class _jcharArray : public _jarray {}; class _jshortArray : public _jarray {}; class _jintArray : public _jarray {}; class _jlongArray : public _jarray {}; class _jfloatArray : public _jarray {}; class _jdoubleArray : public _jarray {}; class _jthrowable : public _jobject {}; typedef _jobject* jobject; typedef _jclass* jclass; typedef _jstring* jstring; typedef _jarray* jarray; typedef _jobjectArray* jobjectArray; typedef _jbooleanArray* jbooleanArray; typedef _jbyteArray* jbyteArray; typedef _jcharArray* jcharArray; typedef _jshortArray* jshortArray; typedef _jintArray* jintArray; typedef _jlongArray* jlongArray; typedef _jfloatArray* jfloatArray; typedef _jdoubleArray* jdoubleArray; typedef _jthrowable* jthrowable; typedef _jobject* jweak; #else /* not __cplusplus */ /* * Reference types, in C. */ typedef void* jobject; typedef jobject jclass; typedef jobject jstring; typedef jobject jarray; typedef jarray jobjectArray; typedef jarray jbooleanArray; typedef jarray jbyteArray; typedef jarray jcharArray; typedef jarray jshortArray; typedef jarray jintArray; typedef jarray jlongArray; typedef jarray jfloatArray; typedef jarray jdoubleArray; typedef jobject jthrowable; typedef jobject jweak; #endif /* not __cplusplus */ struct _jfieldID; /* opaque structure */ typedef struct _jfieldID* jfieldID; /* field IDs */ struct _jmethodID; /* opaque structure */ typedef struct _jmethodID* jmethodID; /* method IDs */ struct JNIInvokeInterface; typedef union jvalue { jboolean z; jbyte b; jchar c; jshort s; jint i; jlong j; jfloat f; jdouble d; jobject l; } jvalue; typedef enum jobjectRefType { JNIInvalidRefType = 0, JNILocalRefType = 1, JNIGlobalRefType = 2, JNIWeakGlobalRefType = 3 } jobjectRefType; typedef struct { const char* name; const char* signature; void* fnPtr; } JNINativeMethod; struct _JNIEnv; struct _JavaVM; typedef const struct JNINativeInterface* C_JNIEnv; #if defined(__cplusplus) typedef _JNIEnv JNIEnv; typedef _JavaVM JavaVM; #else typedef const struct JNINativeInterface* JNIEnv; typedef const struct JNIInvokeInterface* JavaVM; #endif /* * Table of interface function pointers. */ struct JNINativeInterface { void* reserved0; void* reserved1; void* reserved2; void* reserved3; jint (*GetVersion)(JNIEnv *); jclass (*DefineClass)(JNIEnv*, const char*, jobject, const jbyte*, jsize); jclass (*FindClass)(JNIEnv*, const char*); jmethodID (*FromReflectedMethod)(JNIEnv*, jobject); jfieldID (*FromReflectedField)(JNIEnv*, jobject); /* spec doesn't show jboolean parameter */ jobject (*ToReflectedMethod)(JNIEnv*, jclass, jmethodID, jboolean); jclass (*GetSuperclass)(JNIEnv*, jclass); jboolean (*IsAssignableFrom)(JNIEnv*, jclass, jclass); /* spec doesn't show jboolean parameter */ jobject (*ToReflectedField)(JNIEnv*, jclass, jfieldID, jboolean); jint (*Throw)(JNIEnv*, jthrowable); jint (*ThrowNew)(JNIEnv *, jclass, const char *); jthrowable (*ExceptionOccurred)(JNIEnv*); void (*ExceptionDescribe)(JNIEnv*); void (*ExceptionClear)(JNIEnv*); void (*FatalError)(JNIEnv*, const char*); jint (*PushLocalFrame)(JNIEnv*, jint); jobject (*PopLocalFrame)(JNIEnv*, jobject); jobject (*NewGlobalRef)(JNIEnv*, jobject); void (*DeleteGlobalRef)(JNIEnv*, jobject); void (*DeleteLocalRef)(JNIEnv*, jobject); jboolean (*IsSameObject)(JNIEnv*, jobject, jobject); jobject (*NewLocalRef)(JNIEnv*, jobject); jint (*EnsureLocalCapacity)(JNIEnv*, jint); jobject (*AllocObject)(JNIEnv*, jclass); jobject (*NewObject)(JNIEnv*, jclass, jmethodID, ...); jobject (*NewObjectV)(JNIEnv*, jclass, jmethodID, va_list); jobject (*NewObjectA)(JNIEnv*, jclass, jmethodID, jvalue*); jclass (*GetObjectClass)(JNIEnv*, jobject); jboolean (*IsInstanceOf)(JNIEnv*, jobject, jclass); jmethodID (*GetMethodID)(JNIEnv*, jclass, const char*, const char*); jobject (*CallObjectMethod)(JNIEnv*, jobject, jmethodID, ...); jobject (*CallObjectMethodV)(JNIEnv*, jobject, jmethodID, va_list); jobject (*CallObjectMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jboolean (*CallBooleanMethod)(JNIEnv*, jobject, jmethodID, ...); jboolean (*CallBooleanMethodV)(JNIEnv*, jobject, jmethodID, va_list); jboolean (*CallBooleanMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jbyte (*CallByteMethod)(JNIEnv*, jobject, jmethodID, ...); jbyte (*CallByteMethodV)(JNIEnv*, jobject, jmethodID, va_list); jbyte (*CallByteMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jchar (*CallCharMethod)(JNIEnv*, jobject, jmethodID, ...); jchar (*CallCharMethodV)(JNIEnv*, jobject, jmethodID, va_list); jchar (*CallCharMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jshort (*CallShortMethod)(JNIEnv*, jobject, jmethodID, ...); jshort (*CallShortMethodV)(JNIEnv*, jobject, jmethodID, va_list); jshort (*CallShortMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jint (*CallIntMethod)(JNIEnv*, jobject, jmethodID, ...); jint (*CallIntMethodV)(JNIEnv*, jobject, jmethodID, va_list); jint (*CallIntMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jlong (*CallLongMethod)(JNIEnv*, jobject, jmethodID, ...); jlong (*CallLongMethodV)(JNIEnv*, jobject, jmethodID, va_list); jlong (*CallLongMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jfloat (*CallFloatMethod)(JNIEnv*, jobject, jmethodID, ...); jfloat (*CallFloatMethodV)(JNIEnv*, jobject, jmethodID, va_list); jfloat (*CallFloatMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jdouble (*CallDoubleMethod)(JNIEnv*, jobject, jmethodID, ...); jdouble (*CallDoubleMethodV)(JNIEnv*, jobject, jmethodID, va_list); jdouble (*CallDoubleMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); void (*CallVoidMethod)(JNIEnv*, jobject, jmethodID, ...); void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list); void (*CallVoidMethodA)(JNIEnv*, jobject, jmethodID, jvalue*); jobject (*CallNonvirtualObjectMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jobject (*CallNonvirtualObjectMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jobject (*CallNonvirtualObjectMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jboolean (*CallNonvirtualBooleanMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jboolean (*CallNonvirtualBooleanMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jboolean (*CallNonvirtualBooleanMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jbyte (*CallNonvirtualByteMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jbyte (*CallNonvirtualByteMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jbyte (*CallNonvirtualByteMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jchar (*CallNonvirtualCharMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jchar (*CallNonvirtualCharMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jchar (*CallNonvirtualCharMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jshort (*CallNonvirtualShortMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jshort (*CallNonvirtualShortMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jshort (*CallNonvirtualShortMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jint (*CallNonvirtualIntMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jint (*CallNonvirtualIntMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jint (*CallNonvirtualIntMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jlong (*CallNonvirtualLongMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jlong (*CallNonvirtualLongMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jlong (*CallNonvirtualLongMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jfloat (*CallNonvirtualFloatMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jfloat (*CallNonvirtualFloatMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jfloat (*CallNonvirtualFloatMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jdouble (*CallNonvirtualDoubleMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); jdouble (*CallNonvirtualDoubleMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); jdouble (*CallNonvirtualDoubleMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); void (*CallNonvirtualVoidMethod)(JNIEnv*, jobject, jclass, jmethodID, ...); void (*CallNonvirtualVoidMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list); void (*CallNonvirtualVoidMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*); jfieldID (*GetFieldID)(JNIEnv*, jclass, const char*, const char*); jobject (*GetObjectField)(JNIEnv*, jobject, jfieldID); jboolean (*GetBooleanField)(JNIEnv*, jobject, jfieldID); jbyte (*GetByteField)(JNIEnv*, jobject, jfieldID); jchar (*GetCharField)(JNIEnv*, jobject, jfieldID); jshort (*GetShortField)(JNIEnv*, jobject, jfieldID); jint (*GetIntField)(JNIEnv*, jobject, jfieldID); jlong (*GetLongField)(JNIEnv*, jobject, jfieldID); jfloat (*GetFloatField)(JNIEnv*, jobject, jfieldID); jdouble (*GetDoubleField)(JNIEnv*, jobject, jfieldID); void (*SetObjectField)(JNIEnv*, jobject, jfieldID, jobject); void (*SetBooleanField)(JNIEnv*, jobject, jfieldID, jboolean); void (*SetByteField)(JNIEnv*, jobject, jfieldID, jbyte); void (*SetCharField)(JNIEnv*, jobject, jfieldID, jchar); void (*SetShortField)(JNIEnv*, jobject, jfieldID, jshort); void (*SetIntField)(JNIEnv*, jobject, jfieldID, jint); void (*SetLongField)(JNIEnv*, jobject, jfieldID, jlong); void (*SetFloatField)(JNIEnv*, jobject, jfieldID, jfloat); void (*SetDoubleField)(JNIEnv*, jobject, jfieldID, jdouble); jmethodID (*GetStaticMethodID)(JNIEnv*, jclass, const char*, const char*); jobject (*CallStaticObjectMethod)(JNIEnv*, jclass, jmethodID, ...); jobject (*CallStaticObjectMethodV)(JNIEnv*, jclass, jmethodID, va_list); jobject (*CallStaticObjectMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jboolean (*CallStaticBooleanMethod)(JNIEnv*, jclass, jmethodID, ...); jboolean (*CallStaticBooleanMethodV)(JNIEnv*, jclass, jmethodID, va_list); jboolean (*CallStaticBooleanMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jbyte (*CallStaticByteMethod)(JNIEnv*, jclass, jmethodID, ...); jbyte (*CallStaticByteMethodV)(JNIEnv*, jclass, jmethodID, va_list); jbyte (*CallStaticByteMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jchar (*CallStaticCharMethod)(JNIEnv*, jclass, jmethodID, ...); jchar (*CallStaticCharMethodV)(JNIEnv*, jclass, jmethodID, va_list); jchar (*CallStaticCharMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jshort (*CallStaticShortMethod)(JNIEnv*, jclass, jmethodID, ...); jshort (*CallStaticShortMethodV)(JNIEnv*, jclass, jmethodID, va_list); jshort (*CallStaticShortMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jint (*CallStaticIntMethod)(JNIEnv*, jclass, jmethodID, ...); jint (*CallStaticIntMethodV)(JNIEnv*, jclass, jmethodID, va_list); jint (*CallStaticIntMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jlong (*CallStaticLongMethod)(JNIEnv*, jclass, jmethodID, ...); jlong (*CallStaticLongMethodV)(JNIEnv*, jclass, jmethodID, va_list); jlong (*CallStaticLongMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jfloat (*CallStaticFloatMethod)(JNIEnv*, jclass, jmethodID, ...); jfloat (*CallStaticFloatMethodV)(JNIEnv*, jclass, jmethodID, va_list); jfloat (*CallStaticFloatMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jdouble (*CallStaticDoubleMethod)(JNIEnv*, jclass, jmethodID, ...); jdouble (*CallStaticDoubleMethodV)(JNIEnv*, jclass, jmethodID, va_list); jdouble (*CallStaticDoubleMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); void (*CallStaticVoidMethod)(JNIEnv*, jclass, jmethodID, ...); void (*CallStaticVoidMethodV)(JNIEnv*, jclass, jmethodID, va_list); void (*CallStaticVoidMethodA)(JNIEnv*, jclass, jmethodID, jvalue*); jfieldID (*GetStaticFieldID)(JNIEnv*, jclass, const char*, const char*); jobject (*GetStaticObjectField)(JNIEnv*, jclass, jfieldID); jboolean (*GetStaticBooleanField)(JNIEnv*, jclass, jfieldID); jbyte (*GetStaticByteField)(JNIEnv*, jclass, jfieldID); jchar (*GetStaticCharField)(JNIEnv*, jclass, jfieldID); jshort (*GetStaticShortField)(JNIEnv*, jclass, jfieldID); jint (*GetStaticIntField)(JNIEnv*, jclass, jfieldID); jlong (*GetStaticLongField)(JNIEnv*, jclass, jfieldID); jfloat (*GetStaticFloatField)(JNIEnv*, jclass, jfieldID); jdouble (*GetStaticDoubleField)(JNIEnv*, jclass, jfieldID); void (*SetStaticObjectField)(JNIEnv*, jclass, jfieldID, jobject); void (*SetStaticBooleanField)(JNIEnv*, jclass, jfieldID, jboolean); void (*SetStaticByteField)(JNIEnv*, jclass, jfieldID, jbyte); void (*SetStaticCharField)(JNIEnv*, jclass, jfieldID, jchar); void (*SetStaticShortField)(JNIEnv*, jclass, jfieldID, jshort); void (*SetStaticIntField)(JNIEnv*, jclass, jfieldID, jint); void (*SetStaticLongField)(JNIEnv*, jclass, jfieldID, jlong); void (*SetStaticFloatField)(JNIEnv*, jclass, jfieldID, jfloat); void (*SetStaticDoubleField)(JNIEnv*, jclass, jfieldID, jdouble); jstring (*NewString)(JNIEnv*, const jchar*, jsize); jsize (*GetStringLength)(JNIEnv*, jstring); const jchar* (*GetStringChars)(JNIEnv*, jstring, jboolean*); void (*ReleaseStringChars)(JNIEnv*, jstring, const jchar*); jstring (*NewStringUTF)(JNIEnv*, const char*); jsize (*GetStringUTFLength)(JNIEnv*, jstring); /* JNI spec says this returns const jbyte*, but that's inconsistent */ const char* (*GetStringUTFChars)(JNIEnv*, jstring, jboolean*); void (*ReleaseStringUTFChars)(JNIEnv*, jstring, const char*); jsize (*GetArrayLength)(JNIEnv*, jarray); jobjectArray (*NewObjectArray)(JNIEnv*, jsize, jclass, jobject); jobject (*GetObjectArrayElement)(JNIEnv*, jobjectArray, jsize); void (*SetObjectArrayElement)(JNIEnv*, jobjectArray, jsize, jobject); jbooleanArray (*NewBooleanArray)(JNIEnv*, jsize); jbyteArray (*NewByteArray)(JNIEnv*, jsize); jcharArray (*NewCharArray)(JNIEnv*, jsize); jshortArray (*NewShortArray)(JNIEnv*, jsize); jintArray (*NewIntArray)(JNIEnv*, jsize); jlongArray (*NewLongArray)(JNIEnv*, jsize); jfloatArray (*NewFloatArray)(JNIEnv*, jsize); jdoubleArray (*NewDoubleArray)(JNIEnv*, jsize); jboolean* (*GetBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*); jbyte* (*GetByteArrayElements)(JNIEnv*, jbyteArray, jboolean*); jchar* (*GetCharArrayElements)(JNIEnv*, jcharArray, jboolean*); jshort* (*GetShortArrayElements)(JNIEnv*, jshortArray, jboolean*); jint* (*GetIntArrayElements)(JNIEnv*, jintArray, jboolean*); jlong* (*GetLongArrayElements)(JNIEnv*, jlongArray, jboolean*); jfloat* (*GetFloatArrayElements)(JNIEnv*, jfloatArray, jboolean*); jdouble* (*GetDoubleArrayElements)(JNIEnv*, jdoubleArray, jboolean*); void (*ReleaseBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*, jint); void (*ReleaseByteArrayElements)(JNIEnv*, jbyteArray, jbyte*, jint); void (*ReleaseCharArrayElements)(JNIEnv*, jcharArray, jchar*, jint); void (*ReleaseShortArrayElements)(JNIEnv*, jshortArray, jshort*, jint); void (*ReleaseIntArrayElements)(JNIEnv*, jintArray, jint*, jint); void (*ReleaseLongArrayElements)(JNIEnv*, jlongArray, jlong*, jint); void (*ReleaseFloatArrayElements)(JNIEnv*, jfloatArray, jfloat*, jint); void (*ReleaseDoubleArrayElements)(JNIEnv*, jdoubleArray, jdouble*, jint); void (*GetBooleanArrayRegion)(JNIEnv*, jbooleanArray, jsize, jsize, jboolean*); void (*GetByteArrayRegion)(JNIEnv*, jbyteArray, jsize, jsize, jbyte*); void (*GetCharArrayRegion)(JNIEnv*, jcharArray, jsize, jsize, jchar*); void (*GetShortArrayRegion)(JNIEnv*, jshortArray, jsize, jsize, jshort*); void (*GetIntArrayRegion)(JNIEnv*, jintArray, jsize, jsize, jint*); void (*GetLongArrayRegion)(JNIEnv*, jlongArray, jsize, jsize, jlong*); void (*GetFloatArrayRegion)(JNIEnv*, jfloatArray, jsize, jsize, jfloat*); void (*GetDoubleArrayRegion)(JNIEnv*, jdoubleArray, jsize, jsize, jdouble*); /* spec shows these without const; some jni.h do, some don't */ void (*SetBooleanArrayRegion)(JNIEnv*, jbooleanArray, jsize, jsize, const jboolean*); void (*SetByteArrayRegion)(JNIEnv*, jbyteArray, jsize, jsize, const jbyte*); void (*SetCharArrayRegion)(JNIEnv*, jcharArray, jsize, jsize, const jchar*); void (*SetShortArrayRegion)(JNIEnv*, jshortArray, jsize, jsize, const jshort*); void (*SetIntArrayRegion)(JNIEnv*, jintArray, jsize, jsize, const jint*); void (*SetLongArrayRegion)(JNIEnv*, jlongArray, jsize, jsize, const jlong*); void (*SetFloatArrayRegion)(JNIEnv*, jfloatArray, jsize, jsize, const jfloat*); void (*SetDoubleArrayRegion)(JNIEnv*, jdoubleArray, jsize, jsize, const jdouble*); jint (*RegisterNatives)(JNIEnv*, jclass, const JNINativeMethod*, jint); jint (*UnregisterNatives)(JNIEnv*, jclass); jint (*MonitorEnter)(JNIEnv*, jobject); jint (*MonitorExit)(JNIEnv*, jobject); jint (*GetJavaVM)(JNIEnv*, JavaVM**); void (*GetStringRegion)(JNIEnv*, jstring, jsize, jsize, jchar*); void (*GetStringUTFRegion)(JNIEnv*, jstring, jsize, jsize, char*); void* (*GetPrimitiveArrayCritical)(JNIEnv*, jarray, jboolean*); void (*ReleasePrimitiveArrayCritical)(JNIEnv*, jarray, void*, jint); const jchar* (*GetStringCritical)(JNIEnv*, jstring, jboolean*); void (*ReleaseStringCritical)(JNIEnv*, jstring, const jchar*); jweak (*NewWeakGlobalRef)(JNIEnv*, jobject); void (*DeleteWeakGlobalRef)(JNIEnv*, jweak); jboolean (*ExceptionCheck)(JNIEnv*); jobject (*NewDirectByteBuffer)(JNIEnv*, void*, jlong); void* (*GetDirectBufferAddress)(JNIEnv*, jobject); jlong (*GetDirectBufferCapacity)(JNIEnv*, jobject); /* added in JNI 1.6 */ jobjectRefType (*GetObjectRefType)(JNIEnv*, jobject); }; /* * C++ object wrapper. * * This is usually overlaid on a C struct whose first element is a * JNINativeInterface*. We rely somewhat on compiler behavior. */ struct _JNIEnv { /* do not rename this; it does not seem to be entirely opaque */ const struct JNINativeInterface* functions; #if defined(__cplusplus) jint GetVersion() { return functions->GetVersion(this); } jclass DefineClass(const char *name, jobject loader, const jbyte* buf, jsize bufLen) { return functions->DefineClass(this, name, loader, buf, bufLen); } jclass FindClass(const char* name) { return functions->FindClass(this, name); } jmethodID FromReflectedMethod(jobject method) { return functions->FromReflectedMethod(this, method); } jfieldID FromReflectedField(jobject field) { return functions->FromReflectedField(this, field); } jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) { return functions->ToReflectedMethod(this, cls, methodID, isStatic); } jclass GetSuperclass(jclass clazz) { return functions->GetSuperclass(this, clazz); } jboolean IsAssignableFrom(jclass clazz1, jclass clazz2) { return functions->IsAssignableFrom(this, clazz1, clazz2); } jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) { return functions->ToReflectedField(this, cls, fieldID, isStatic); } jint Throw(jthrowable obj) { return functions->Throw(this, obj); } jint ThrowNew(jclass clazz, const char* message) { return functions->ThrowNew(this, clazz, message); } jthrowable ExceptionOccurred() { return functions->ExceptionOccurred(this); } void ExceptionDescribe() { functions->ExceptionDescribe(this); } void ExceptionClear() { functions->ExceptionClear(this); } void FatalError(const char* msg) { functions->FatalError(this, msg); } jint PushLocalFrame(jint capacity) { return functions->PushLocalFrame(this, capacity); } jobject PopLocalFrame(jobject result) { return functions->PopLocalFrame(this, result); } jobject NewGlobalRef(jobject obj) { return functions->NewGlobalRef(this, obj); } void DeleteGlobalRef(jobject globalRef) { functions->DeleteGlobalRef(this, globalRef); } void DeleteLocalRef(jobject localRef) { functions->DeleteLocalRef(this, localRef); } jboolean IsSameObject(jobject ref1, jobject ref2) { return functions->IsSameObject(this, ref1, ref2); } jobject NewLocalRef(jobject ref) { return functions->NewLocalRef(this, ref); } jint EnsureLocalCapacity(jint capacity) { return functions->EnsureLocalCapacity(this, capacity); } jobject AllocObject(jclass clazz) { return functions->AllocObject(this, clazz); } jobject NewObject(jclass clazz, jmethodID methodID, ...) { va_list args; va_start(args, methodID); jobject result = functions->NewObjectV(this, clazz, methodID, args); va_end(args); return result; } jobject NewObjectV(jclass clazz, jmethodID methodID, va_list args) { return functions->NewObjectV(this, clazz, methodID, args); } jobject NewObjectA(jclass clazz, jmethodID methodID, jvalue* args) { return functions->NewObjectA(this, clazz, methodID, args); } jclass GetObjectClass(jobject obj) { return functions->GetObjectClass(this, obj); } jboolean IsInstanceOf(jobject obj, jclass clazz) { return functions->IsInstanceOf(this, obj, clazz); } jmethodID GetMethodID(jclass clazz, const char* name, const char* sig) { return functions->GetMethodID(this, clazz, name, sig); } #define CALL_TYPE_METHOD(_jtype, _jname) \ _jtype Call##_jname##Method(jobject obj, jmethodID methodID, ...) \ { \ _jtype result; \ va_list args; \ va_start(args, methodID); \ result = functions->Call##_jname##MethodV(this, obj, methodID, \ args); \ va_end(args); \ return result; \ } #define CALL_TYPE_METHODV(_jtype, _jname) \ _jtype Call##_jname##MethodV(jobject obj, jmethodID methodID, \ va_list args) \ { return functions->Call##_jname##MethodV(this, obj, methodID, args); } #define CALL_TYPE_METHODA(_jtype, _jname) \ _jtype Call##_jname##MethodA(jobject obj, jmethodID methodID, \ jvalue* args) \ { return functions->Call##_jname##MethodA(this, obj, methodID, args); } #define CALL_TYPE(_jtype, _jname) \ CALL_TYPE_METHOD(_jtype, _jname) \ CALL_TYPE_METHODV(_jtype, _jname) \ CALL_TYPE_METHODA(_jtype, _jname) CALL_TYPE(jobject, Object) CALL_TYPE(jboolean, Boolean) CALL_TYPE(jbyte, Byte) CALL_TYPE(jchar, Char) CALL_TYPE(jshort, Short) CALL_TYPE(jint, Int) CALL_TYPE(jlong, Long) CALL_TYPE(jfloat, Float) CALL_TYPE(jdouble, Double) void CallVoidMethod(jobject obj, jmethodID methodID, ...) { va_list args; va_start(args, methodID); functions->CallVoidMethodV(this, obj, methodID, args); va_end(args); } void CallVoidMethodV(jobject obj, jmethodID methodID, va_list args) { functions->CallVoidMethodV(this, obj, methodID, args); } void CallVoidMethodA(jobject obj, jmethodID methodID, jvalue* args) { functions->CallVoidMethodA(this, obj, methodID, args); } #define CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \ _jtype CallNonvirtual##_jname##Method(jobject obj, jclass clazz, \ jmethodID methodID, ...) \ { \ _jtype result; \ va_list args; \ va_start(args, methodID); \ result = functions->CallNonvirtual##_jname##MethodV(this, obj, \ clazz, methodID, args); \ va_end(args); \ return result; \ } #define CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \ _jtype CallNonvirtual##_jname##MethodV(jobject obj, jclass clazz, \ jmethodID methodID, va_list args) \ { return functions->CallNonvirtual##_jname##MethodV(this, obj, clazz, \ methodID, args); } #define CALL_NONVIRT_TYPE_METHODA(_jtype, _jname) \ _jtype CallNonvirtual##_jname##MethodA(jobject obj, jclass clazz, \ jmethodID methodID, jvalue* args) \ { return functions->CallNonvirtual##_jname##MethodA(this, obj, clazz, \ methodID, args); } #define CALL_NONVIRT_TYPE(_jtype, _jname) \ CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \ CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \ CALL_NONVIRT_TYPE_METHODA(_jtype, _jname) CALL_NONVIRT_TYPE(jobject, Object) CALL_NONVIRT_TYPE(jboolean, Boolean) CALL_NONVIRT_TYPE(jbyte, Byte) CALL_NONVIRT_TYPE(jchar, Char) CALL_NONVIRT_TYPE(jshort, Short) CALL_NONVIRT_TYPE(jint, Int) CALL_NONVIRT_TYPE(jlong, Long) CALL_NONVIRT_TYPE(jfloat, Float) CALL_NONVIRT_TYPE(jdouble, Double) void CallNonvirtualVoidMethod(jobject obj, jclass clazz, jmethodID methodID, ...) { va_list args; va_start(args, methodID); functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args); va_end(args); } void CallNonvirtualVoidMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args) { functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args); } void CallNonvirtualVoidMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue* args) { functions->CallNonvirtualVoidMethodA(this, obj, clazz, methodID, args); } jfieldID GetFieldID(jclass clazz, const char* name, const char* sig) { return functions->GetFieldID(this, clazz, name, sig); } jobject GetObjectField(jobject obj, jfieldID fieldID) { return functions->GetObjectField(this, obj, fieldID); } jboolean GetBooleanField(jobject obj, jfieldID fieldID) { return functions->GetBooleanField(this, obj, fieldID); } jbyte GetByteField(jobject obj, jfieldID fieldID) { return functions->GetByteField(this, obj, fieldID); } jchar GetCharField(jobject obj, jfieldID fieldID) { return functions->GetCharField(this, obj, fieldID); } jshort GetShortField(jobject obj, jfieldID fieldID) { return functions->GetShortField(this, obj, fieldID); } jint GetIntField(jobject obj, jfieldID fieldID) { return functions->GetIntField(this, obj, fieldID); } jlong GetLongField(jobject obj, jfieldID fieldID) { return functions->GetLongField(this, obj, fieldID); } jfloat GetFloatField(jobject obj, jfieldID fieldID) { return functions->GetFloatField(this, obj, fieldID); } jdouble GetDoubleField(jobject obj, jfieldID fieldID) { return functions->GetDoubleField(this, obj, fieldID); } void SetObjectField(jobject obj, jfieldID fieldID, jobject value) { functions->SetObjectField(this, obj, fieldID, value); } void SetBooleanField(jobject obj, jfieldID fieldID, jboolean value) { functions->SetBooleanField(this, obj, fieldID, value); } void SetByteField(jobject obj, jfieldID fieldID, jbyte value) { functions->SetByteField(this, obj, fieldID, value); } void SetCharField(jobject obj, jfieldID fieldID, jchar value) { functions->SetCharField(this, obj, fieldID, value); } void SetShortField(jobject obj, jfieldID fieldID, jshort value) { functions->SetShortField(this, obj, fieldID, value); } void SetIntField(jobject obj, jfieldID fieldID, jint value) { functions->SetIntField(this, obj, fieldID, value); } void SetLongField(jobject obj, jfieldID fieldID, jlong value) { functions->SetLongField(this, obj, fieldID, value); } void SetFloatField(jobject obj, jfieldID fieldID, jfloat value) { functions->SetFloatField(this, obj, fieldID, value); } void SetDoubleField(jobject obj, jfieldID fieldID, jdouble value) { functions->SetDoubleField(this, obj, fieldID, value); } jmethodID GetStaticMethodID(jclass clazz, const char* name, const char* sig) { return functions->GetStaticMethodID(this, clazz, name, sig); } #define CALL_STATIC_TYPE_METHOD(_jtype, _jname) \ _jtype CallStatic##_jname##Method(jclass clazz, jmethodID methodID, \ ...) \ { \ _jtype result; \ va_list args; \ va_start(args, methodID); \ result = functions->CallStatic##_jname##MethodV(this, clazz, \ methodID, args); \ va_end(args); \ return result; \ } #define CALL_STATIC_TYPE_METHODV(_jtype, _jname) \ _jtype CallStatic##_jname##MethodV(jclass clazz, jmethodID methodID, \ va_list args) \ { return functions->CallStatic##_jname##MethodV(this, clazz, methodID, \ args); } #define CALL_STATIC_TYPE_METHODA(_jtype, _jname) \ _jtype CallStatic##_jname##MethodA(jclass clazz, jmethodID methodID, \ jvalue* args) \ { return functions->CallStatic##_jname##MethodA(this, clazz, methodID, \ args); } #define CALL_STATIC_TYPE(_jtype, _jname) \ CALL_STATIC_TYPE_METHOD(_jtype, _jname) \ CALL_STATIC_TYPE_METHODV(_jtype, _jname) \ CALL_STATIC_TYPE_METHODA(_jtype, _jname) CALL_STATIC_TYPE(jobject, Object) CALL_STATIC_TYPE(jboolean, Boolean) CALL_STATIC_TYPE(jbyte, Byte) CALL_STATIC_TYPE(jchar, Char) CALL_STATIC_TYPE(jshort, Short) CALL_STATIC_TYPE(jint, Int) CALL_STATIC_TYPE(jlong, Long) CALL_STATIC_TYPE(jfloat, Float) CALL_STATIC_TYPE(jdouble, Double) void CallStaticVoidMethod(jclass clazz, jmethodID methodID, ...) { va_list args; va_start(args, methodID); functions->CallStaticVoidMethodV(this, clazz, methodID, args); va_end(args); } void CallStaticVoidMethodV(jclass clazz, jmethodID methodID, va_list args) { functions->CallStaticVoidMethodV(this, clazz, methodID, args); } void CallStaticVoidMethodA(jclass clazz, jmethodID methodID, jvalue* args) { functions->CallStaticVoidMethodA(this, clazz, methodID, args); } jfieldID GetStaticFieldID(jclass clazz, const char* name, const char* sig) { return functions->GetStaticFieldID(this, clazz, name, sig); } jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) { return functions->GetStaticObjectField(this, clazz, fieldID); } jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) { return functions->GetStaticBooleanField(this, clazz, fieldID); } jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) { return functions->GetStaticByteField(this, clazz, fieldID); } jchar GetStaticCharField(jclass clazz, jfieldID fieldID) { return functions->GetStaticCharField(this, clazz, fieldID); } jshort GetStaticShortField(jclass clazz, jfieldID fieldID) { return functions->GetStaticShortField(this, clazz, fieldID); } jint GetStaticIntField(jclass clazz, jfieldID fieldID) { return functions->GetStaticIntField(this, clazz, fieldID); } jlong GetStaticLongField(jclass clazz, jfieldID fieldID) { return functions->GetStaticLongField(this, clazz, fieldID); } jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) { return functions->GetStaticFloatField(this, clazz, fieldID); } jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) { return functions->GetStaticDoubleField(this, clazz, fieldID); } void SetStaticObjectField(jclass clazz, jfieldID fieldID, jobject value) { functions->SetStaticObjectField(this, clazz, fieldID, value); } void SetStaticBooleanField(jclass clazz, jfieldID fieldID, jboolean value) { functions->SetStaticBooleanField(this, clazz, fieldID, value); } void SetStaticByteField(jclass clazz, jfieldID fieldID, jbyte value) { functions->SetStaticByteField(this, clazz, fieldID, value); } void SetStaticCharField(jclass clazz, jfieldID fieldID, jchar value) { functions->SetStaticCharField(this, clazz, fieldID, value); } void SetStaticShortField(jclass clazz, jfieldID fieldID, jshort value) { functions->SetStaticShortField(this, clazz, fieldID, value); } void SetStaticIntField(jclass clazz, jfieldID fieldID, jint value) { functions->SetStaticIntField(this, clazz, fieldID, value); } void SetStaticLongField(jclass clazz, jfieldID fieldID, jlong value) { functions->SetStaticLongField(this, clazz, fieldID, value); } void SetStaticFloatField(jclass clazz, jfieldID fieldID, jfloat value) { functions->SetStaticFloatField(this, clazz, fieldID, value); } void SetStaticDoubleField(jclass clazz, jfieldID fieldID, jdouble value) { functions->SetStaticDoubleField(this, clazz, fieldID, value); } jstring NewString(const jchar* unicodeChars, jsize len) { return functions->NewString(this, unicodeChars, len); } jsize GetStringLength(jstring string) { return functions->GetStringLength(this, string); } const jchar* GetStringChars(jstring string, jboolean* isCopy) { return functions->GetStringChars(this, string, isCopy); } void ReleaseStringChars(jstring string, const jchar* chars) { functions->ReleaseStringChars(this, string, chars); } jstring NewStringUTF(const char* bytes) { return functions->NewStringUTF(this, bytes); } jsize GetStringUTFLength(jstring string) { return functions->GetStringUTFLength(this, string); } const char* GetStringUTFChars(jstring string, jboolean* isCopy) { return functions->GetStringUTFChars(this, string, isCopy); } void ReleaseStringUTFChars(jstring string, const char* utf) { functions->ReleaseStringUTFChars(this, string, utf); } jsize GetArrayLength(jarray array) { return functions->GetArrayLength(this, array); } jobjectArray NewObjectArray(jsize length, jclass elementClass, jobject initialElement) { return functions->NewObjectArray(this, length, elementClass, initialElement); } jobject GetObjectArrayElement(jobjectArray array, jsize index) { return functions->GetObjectArrayElement(this, array, index); } void SetObjectArrayElement(jobjectArray array, jsize index, jobject value) { functions->SetObjectArrayElement(this, array, index, value); } jbooleanArray NewBooleanArray(jsize length) { return functions->NewBooleanArray(this, length); } jbyteArray NewByteArray(jsize length) { return functions->NewByteArray(this, length); } jcharArray NewCharArray(jsize length) { return functions->NewCharArray(this, length); } jshortArray NewShortArray(jsize length) { return functions->NewShortArray(this, length); } jintArray NewIntArray(jsize length) { return functions->NewIntArray(this, length); } jlongArray NewLongArray(jsize length) { return functions->NewLongArray(this, length); } jfloatArray NewFloatArray(jsize length) { return functions->NewFloatArray(this, length); } jdoubleArray NewDoubleArray(jsize length) { return functions->NewDoubleArray(this, length); } jboolean* GetBooleanArrayElements(jbooleanArray array, jboolean* isCopy) { return functions->GetBooleanArrayElements(this, array, isCopy); } jbyte* GetByteArrayElements(jbyteArray array, jboolean* isCopy) { return functions->GetByteArrayElements(this, array, isCopy); } jchar* GetCharArrayElements(jcharArray array, jboolean* isCopy) { return functions->GetCharArrayElements(this, array, isCopy); } jshort* GetShortArrayElements(jshortArray array, jboolean* isCopy) { return functions->GetShortArrayElements(this, array, isCopy); } jint* GetIntArrayElements(jintArray array, jboolean* isCopy) { return functions->GetIntArrayElements(this, array, isCopy); } jlong* GetLongArrayElements(jlongArray array, jboolean* isCopy) { return functions->GetLongArrayElements(this, array, isCopy); } jfloat* GetFloatArrayElements(jfloatArray array, jboolean* isCopy) { return functions->GetFloatArrayElements(this, array, isCopy); } jdouble* GetDoubleArrayElements(jdoubleArray array, jboolean* isCopy) { return functions->GetDoubleArrayElements(this, array, isCopy); } void ReleaseBooleanArrayElements(jbooleanArray array, jboolean* elems, jint mode) { functions->ReleaseBooleanArrayElements(this, array, elems, mode); } void ReleaseByteArrayElements(jbyteArray array, jbyte* elems, jint mode) { functions->ReleaseByteArrayElements(this, array, elems, mode); } void ReleaseCharArrayElements(jcharArray array, jchar* elems, jint mode) { functions->ReleaseCharArrayElements(this, array, elems, mode); } void ReleaseShortArrayElements(jshortArray array, jshort* elems, jint mode) { functions->ReleaseShortArrayElements(this, array, elems, mode); } void ReleaseIntArrayElements(jintArray array, jint* elems, jint mode) { functions->ReleaseIntArrayElements(this, array, elems, mode); } void ReleaseLongArrayElements(jlongArray array, jlong* elems, jint mode) { functions->ReleaseLongArrayElements(this, array, elems, mode); } void ReleaseFloatArrayElements(jfloatArray array, jfloat* elems, jint mode) { functions->ReleaseFloatArrayElements(this, array, elems, mode); } void ReleaseDoubleArrayElements(jdoubleArray array, jdouble* elems, jint mode) { functions->ReleaseDoubleArrayElements(this, array, elems, mode); } void GetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, jboolean* buf) { functions->GetBooleanArrayRegion(this, array, start, len, buf); } void GetByteArrayRegion(jbyteArray array, jsize start, jsize len, jbyte* buf) { functions->GetByteArrayRegion(this, array, start, len, buf); } void GetCharArrayRegion(jcharArray array, jsize start, jsize len, jchar* buf) { functions->GetCharArrayRegion(this, array, start, len, buf); } void GetShortArrayRegion(jshortArray array, jsize start, jsize len, jshort* buf) { functions->GetShortArrayRegion(this, array, start, len, buf); } void GetIntArrayRegion(jintArray array, jsize start, jsize len, jint* buf) { functions->GetIntArrayRegion(this, array, start, len, buf); } void GetLongArrayRegion(jlongArray array, jsize start, jsize len, jlong* buf) { functions->GetLongArrayRegion(this, array, start, len, buf); } void GetFloatArrayRegion(jfloatArray array, jsize start, jsize len, jfloat* buf) { functions->GetFloatArrayRegion(this, array, start, len, buf); } void GetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, jdouble* buf) { functions->GetDoubleArrayRegion(this, array, start, len, buf); } void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, const jboolean* buf) { functions->SetBooleanArrayRegion(this, array, start, len, buf); } void SetByteArrayRegion(jbyteArray array, jsize start, jsize len, const jbyte* buf) { functions->SetByteArrayRegion(this, array, start, len, buf); } void SetCharArrayRegion(jcharArray array, jsize start, jsize len, const jchar* buf) { functions->SetCharArrayRegion(this, array, start, len, buf); } void SetShortArrayRegion(jshortArray array, jsize start, jsize len, const jshort* buf) { functions->SetShortArrayRegion(this, array, start, len, buf); } void SetIntArrayRegion(jintArray array, jsize start, jsize len, const jint* buf) { functions->SetIntArrayRegion(this, array, start, len, buf); } void SetLongArrayRegion(jlongArray array, jsize start, jsize len, const jlong* buf) { functions->SetLongArrayRegion(this, array, start, len, buf); } void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, const jfloat* buf) { functions->SetFloatArrayRegion(this, array, start, len, buf); } void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, const jdouble* buf) { functions->SetDoubleArrayRegion(this, array, start, len, buf); } jint RegisterNatives(jclass clazz, const JNINativeMethod* methods, jint nMethods) { return functions->RegisterNatives(this, clazz, methods, nMethods); } jint UnregisterNatives(jclass clazz) { return functions->UnregisterNatives(this, clazz); } jint MonitorEnter(jobject obj) { return functions->MonitorEnter(this, obj); } jint MonitorExit(jobject obj) { return functions->MonitorExit(this, obj); } jint GetJavaVM(JavaVM** vm) { return functions->GetJavaVM(this, vm); } void GetStringRegion(jstring str, jsize start, jsize len, jchar* buf) { functions->GetStringRegion(this, str, start, len, buf); } void GetStringUTFRegion(jstring str, jsize start, jsize len, char* buf) { return functions->GetStringUTFRegion(this, str, start, len, buf); } void* GetPrimitiveArrayCritical(jarray array, jboolean* isCopy) { return functions->GetPrimitiveArrayCritical(this, array, isCopy); } void ReleasePrimitiveArrayCritical(jarray array, void* carray, jint mode) { functions->ReleasePrimitiveArrayCritical(this, array, carray, mode); } const jchar* GetStringCritical(jstring string, jboolean* isCopy) { return functions->GetStringCritical(this, string, isCopy); } void ReleaseStringCritical(jstring string, const jchar* carray) { functions->ReleaseStringCritical(this, string, carray); } jweak NewWeakGlobalRef(jobject obj) { return functions->NewWeakGlobalRef(this, obj); } void DeleteWeakGlobalRef(jweak obj) { functions->DeleteWeakGlobalRef(this, obj); } jboolean ExceptionCheck() { return functions->ExceptionCheck(this); } jobject NewDirectByteBuffer(void* address, jlong capacity) { return functions->NewDirectByteBuffer(this, address, capacity); } void* GetDirectBufferAddress(jobject buf) { return functions->GetDirectBufferAddress(this, buf); } jlong GetDirectBufferCapacity(jobject buf) { return functions->GetDirectBufferCapacity(this, buf); } /* added in JNI 1.6 */ jobjectRefType GetObjectRefType(jobject obj) { return functions->GetObjectRefType(this, obj); } #endif /*__cplusplus*/ }; /* * JNI invocation interface. */ struct JNIInvokeInterface { void* reserved0; void* reserved1; void* reserved2; jint (*DestroyJavaVM)(JavaVM*); jint (*AttachCurrentThread)(JavaVM*, JNIEnv**, void*); jint (*DetachCurrentThread)(JavaVM*); jint (*GetEnv)(JavaVM*, void**, jint); jint (*AttachCurrentThreadAsDaemon)(JavaVM*, JNIEnv**, void*); }; /* * C++ version. */ struct _JavaVM { const struct JNIInvokeInterface* functions; #if defined(__cplusplus) jint DestroyJavaVM() { return functions->DestroyJavaVM(this); } jint AttachCurrentThread(JNIEnv** p_env, void* thr_args) { return functions->AttachCurrentThread(this, p_env, thr_args); } jint DetachCurrentThread() { return functions->DetachCurrentThread(this); } jint GetEnv(void** env, jint version) { return functions->GetEnv(this, env, version); } jint AttachCurrentThreadAsDaemon(JNIEnv** p_env, void* thr_args) { return functions->AttachCurrentThreadAsDaemon(this, p_env, thr_args); } #endif /*__cplusplus*/ }; struct JavaVMAttachArgs { jint version; /* must be >= JNI_VERSION_1_2 */ const char* name; /* NULL or name of thread as modified UTF-8 str */ jobject group; /* global ref of a ThreadGroup object, or NULL */ }; typedef struct JavaVMAttachArgs JavaVMAttachArgs; /* * JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no * longer supported.) */ typedef struct JavaVMOption { const char* optionString; void* extraInfo; } JavaVMOption; typedef struct JavaVMInitArgs { jint version; /* use JNI_VERSION_1_2 or later */ jint nOptions; JavaVMOption* options; jboolean ignoreUnrecognized; } JavaVMInitArgs; #ifdef __cplusplus extern "C" { #endif /* * VM initialization functions. * * Note these are the only symbols exported for JNI by the VM. */ jint JNI_GetDefaultJavaVMInitArgs(void*); jint JNI_CreateJavaVM(JavaVM**, JNIEnv**, void*); jint JNI_GetCreatedJavaVMs(JavaVM**, jsize, jsize*); #define JNIIMPORT #define JNIEXPORT __attribute__ ((visibility ("default"))) #define JNICALL /* * Prototypes for functions exported by loadable shared libs. These are * called by JNI, not provided by JNI. */ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved); JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved); #ifdef __cplusplus } #endif /* * Manifest constants. */ #define JNI_FALSE 0 #define JNI_TRUE 1 #define JNI_VERSION_1_1 0x00010001 #define JNI_VERSION_1_2 0x00010002 #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 #define JNI_OK (0) /* no error */ #define JNI_ERR (-1) /* generic error */ #define JNI_EDETACHED (-2) /* thread detached from the VM */ #define JNI_EVERSION (-3) /* JNI version error */ #define JNI_COMMIT 1 /* copy content, do not free buffer */ #define JNI_ABORT 2 /* free buffer w/o copying back */ #endif /* JNI_H_ */ ================================================ FILE: lib/nlohmann/json.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT /****************************************************************************\ * Note on documentation: The source files contain links to the online * * documentation of the public API at https://json.nlohmann.me. This URL * * contains the most recent documentation and should also be applicable to * * previous versions; documentation for deprecated functions is not * * removed, but marked deprecated. See "Generate documentation" section in * * file docs/README.md. * \****************************************************************************/ #ifndef INCLUDE_NLOHMANN_JSON_HPP_ #define INCLUDE_NLOHMANN_JSON_HPP_ #include // all_of, find, for_each #include // nullptr_t, ptrdiff_t, size_t #include // hash, less #include // initializer_list #ifndef JSON_NO_IO #include // istream, ostream #endif // JSON_NO_IO #include // random_access_iterator_tag #include // unique_ptr #include // string, stoi, to_string #include // declval, forward, move, pair, swap #include // vector // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // This file contains all macro definitions affecting or depending on the ABI #ifndef JSON_SKIP_LIBRARY_VERSION_CHECK #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3 #warning "Already included a different version of the library!" #endif #endif #endif #define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) #define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) #define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum) #ifndef JSON_DIAGNOSTICS #define JSON_DIAGNOSTICS 0 #endif #ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 #endif #if JSON_DIAGNOSTICS #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag #else #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS #endif #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp #else #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON #endif #ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 #endif // Construct the namespace ABI tags component #define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b #define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) #define NLOHMANN_JSON_ABI_TAGS \ NLOHMANN_JSON_ABI_TAGS_CONCAT( \ NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) // Construct the namespace version component #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ _v ## major ## _ ## minor ## _ ## patch #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) #if NLOHMANN_JSON_NAMESPACE_NO_VERSION #define NLOHMANN_JSON_NAMESPACE_VERSION #else #define NLOHMANN_JSON_NAMESPACE_VERSION \ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ NLOHMANN_JSON_VERSION_MINOR, \ NLOHMANN_JSON_VERSION_PATCH) #endif // Combine namespace components #define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b #define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) #ifndef NLOHMANN_JSON_NAMESPACE #define NLOHMANN_JSON_NAMESPACE \ nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ NLOHMANN_JSON_ABI_TAGS, \ NLOHMANN_JSON_NAMESPACE_VERSION) #endif #ifndef NLOHMANN_JSON_NAMESPACE_BEGIN #define NLOHMANN_JSON_NAMESPACE_BEGIN \ namespace nlohmann \ { \ inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ NLOHMANN_JSON_ABI_TAGS, \ NLOHMANN_JSON_NAMESPACE_VERSION) \ { #endif #ifndef NLOHMANN_JSON_NAMESPACE_END #define NLOHMANN_JSON_NAMESPACE_END \ } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ } // namespace nlohmann #endif // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // transform #include // array #include // forward_list #include // inserter, front_inserter, end #include // map #include // string #include // tuple, make_tuple #include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible #include // unordered_map #include // pair, declval #include // valarray // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // nullptr_t #include // exception #if JSON_DIAGNOSTICS #include // accumulate #endif #include // runtime_error #include // to_string #include // vector // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // array #include // size_t #include // uint8_t #include // string // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // declval, pair // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template struct make_void { using type = void; }; template using void_t = typename make_void::type; } // namespace detail NLOHMANN_JSON_NAMESPACE_END NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { // https://en.cppreference.com/w/cpp/experimental/is_detected struct nonesuch { nonesuch() = delete; ~nonesuch() = delete; nonesuch(nonesuch const&) = delete; nonesuch(nonesuch const&&) = delete; void operator=(nonesuch const&) = delete; void operator=(nonesuch&&) = delete; }; template class Op, class... Args> struct detector { using value_t = std::false_type; using type = Default; }; template class Op, class... Args> struct detector>, Op, Args...> { using value_t = std::true_type; using type = Op; }; template class Op, class... Args> using is_detected = typename detector::value_t; template class Op, class... Args> struct is_detected_lazy : is_detected { }; template class Op, class... Args> using detected_t = typename detector::type; template class Op, class... Args> using detected_or = detector; template class Op, class... Args> using detected_or_t = typename detected_or::type; template class Op, class... Args> using is_detected_exact = std::is_same>; template class Op, class... Args> using is_detected_convertible = std::is_convertible, To>; } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-FileCopyrightText: 2016-2021 Evan Nemerson // SPDX-License-Identifier: MIT /* Hedley - https://nemequ.github.io/hedley * Created by Evan Nemerson */ #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) #if defined(JSON_HEDLEY_VERSION) #undef JSON_HEDLEY_VERSION #endif #define JSON_HEDLEY_VERSION 15 #if defined(JSON_HEDLEY_STRINGIFY_EX) #undef JSON_HEDLEY_STRINGIFY_EX #endif #define JSON_HEDLEY_STRINGIFY_EX(x) #x #if defined(JSON_HEDLEY_STRINGIFY) #undef JSON_HEDLEY_STRINGIFY #endif #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) #if defined(JSON_HEDLEY_CONCAT_EX) #undef JSON_HEDLEY_CONCAT_EX #endif #define JSON_HEDLEY_CONCAT_EX(a,b) a##b #if defined(JSON_HEDLEY_CONCAT) #undef JSON_HEDLEY_CONCAT #endif #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) #if defined(JSON_HEDLEY_CONCAT3_EX) #undef JSON_HEDLEY_CONCAT3_EX #endif #define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c #if defined(JSON_HEDLEY_CONCAT3) #undef JSON_HEDLEY_CONCAT3 #endif #define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) #if defined(JSON_HEDLEY_VERSION_ENCODE) #undef JSON_HEDLEY_VERSION_ENCODE #endif #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) #undef JSON_HEDLEY_VERSION_DECODE_MAJOR #endif #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) #undef JSON_HEDLEY_VERSION_DECODE_MINOR #endif #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) #undef JSON_HEDLEY_VERSION_DECODE_REVISION #endif #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) #if defined(JSON_HEDLEY_GNUC_VERSION) #undef JSON_HEDLEY_GNUC_VERSION #endif #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #elif defined(__GNUC__) #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) #endif #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) #undef JSON_HEDLEY_GNUC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_GNUC_VERSION) #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_MSVC_VERSION) #undef JSON_HEDLEY_MSVC_VERSION #endif #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) #elif defined(_MSC_FULL_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) #elif defined(_MSC_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) #endif #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) #undef JSON_HEDLEY_MSVC_VERSION_CHECK #endif #if !defined(JSON_HEDLEY_MSVC_VERSION) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) #elif defined(_MSC_VER) && (_MSC_VER >= 1400) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) #elif defined(_MSC_VER) && (_MSC_VER >= 1200) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) #else #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) #endif #if defined(JSON_HEDLEY_INTEL_VERSION) #undef JSON_HEDLEY_INTEL_VERSION #endif #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) #elif defined(__INTEL_COMPILER) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) #endif #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) #undef JSON_HEDLEY_INTEL_VERSION_CHECK #endif #if defined(JSON_HEDLEY_INTEL_VERSION) #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_INTEL_CL_VERSION) #undef JSON_HEDLEY_INTEL_CL_VERSION #endif #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) #endif #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK #endif #if defined(JSON_HEDLEY_INTEL_CL_VERSION) #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_PGI_VERSION) #undef JSON_HEDLEY_PGI_VERSION #endif #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) #endif #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) #undef JSON_HEDLEY_PGI_VERSION_CHECK #endif #if defined(JSON_HEDLEY_PGI_VERSION) #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION) #undef JSON_HEDLEY_SUNPRO_VERSION #endif #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) #elif defined(__SUNPRO_C) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) #elif defined(__SUNPRO_CC) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION) #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #undef JSON_HEDLEY_EMSCRIPTEN_VERSION #endif #if defined(__EMSCRIPTEN__) #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_ARM_VERSION) #undef JSON_HEDLEY_ARM_VERSION #endif #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) #endif #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) #undef JSON_HEDLEY_ARM_VERSION_CHECK #endif #if defined(JSON_HEDLEY_ARM_VERSION) #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_IBM_VERSION) #undef JSON_HEDLEY_IBM_VERSION #endif #if defined(__ibmxl__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) #elif defined(__xlC__) && defined(__xlC_ver__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) #elif defined(__xlC__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) #endif #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) #undef JSON_HEDLEY_IBM_VERSION_CHECK #endif #if defined(JSON_HEDLEY_IBM_VERSION) #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_VERSION) #undef JSON_HEDLEY_TI_VERSION #endif #if \ defined(__TI_COMPILER_VERSION__) && \ ( \ defined(__TMS470__) || defined(__TI_ARM__) || \ defined(__MSP430__) || \ defined(__TMS320C2000__) \ ) #if (__TI_COMPILER_VERSION__ >= 16000000) #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #endif #if defined(JSON_HEDLEY_TI_VERSION_CHECK) #undef JSON_HEDLEY_TI_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_VERSION) #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL2000_VERSION) #undef JSON_HEDLEY_TI_CL2000_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL2000_VERSION) #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL430_VERSION) #undef JSON_HEDLEY_TI_CL430_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL430_VERSION) #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #undef JSON_HEDLEY_TI_ARMCL_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL6X_VERSION) #undef JSON_HEDLEY_TI_CL6X_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL6X_VERSION) #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL7X_VERSION) #undef JSON_HEDLEY_TI_CL7X_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL7X_VERSION) #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #undef JSON_HEDLEY_TI_CLPRU_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_CRAY_VERSION) #undef JSON_HEDLEY_CRAY_VERSION #endif #if defined(_CRAYC) #if defined(_RELEASE_PATCHLEVEL) #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) #else #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) #endif #endif #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) #undef JSON_HEDLEY_CRAY_VERSION_CHECK #endif #if defined(JSON_HEDLEY_CRAY_VERSION) #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_IAR_VERSION) #undef JSON_HEDLEY_IAR_VERSION #endif #if defined(__IAR_SYSTEMS_ICC__) #if __VER__ > 1000 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) #else #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) #endif #endif #if defined(JSON_HEDLEY_IAR_VERSION_CHECK) #undef JSON_HEDLEY_IAR_VERSION_CHECK #endif #if defined(JSON_HEDLEY_IAR_VERSION) #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TINYC_VERSION) #undef JSON_HEDLEY_TINYC_VERSION #endif #if defined(__TINYC__) #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) #endif #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) #undef JSON_HEDLEY_TINYC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TINYC_VERSION) #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_DMC_VERSION) #undef JSON_HEDLEY_DMC_VERSION #endif #if defined(__DMC__) #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) #endif #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) #undef JSON_HEDLEY_DMC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_DMC_VERSION) #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION) #undef JSON_HEDLEY_COMPCERT_VERSION #endif #if defined(__COMPCERT_VERSION__) #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION) #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_PELLES_VERSION) #undef JSON_HEDLEY_PELLES_VERSION #endif #if defined(__POCC__) #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) #endif #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) #undef JSON_HEDLEY_PELLES_VERSION_CHECK #endif #if defined(JSON_HEDLEY_PELLES_VERSION) #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_MCST_LCC_VERSION) #undef JSON_HEDLEY_MCST_LCC_VERSION #endif #if defined(__LCC__) && defined(__LCC_MINOR__) #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) #endif #if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_MCST_LCC_VERSION) #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_GCC_VERSION) #undef JSON_HEDLEY_GCC_VERSION #endif #if \ defined(JSON_HEDLEY_GNUC_VERSION) && \ !defined(__clang__) && \ !defined(JSON_HEDLEY_INTEL_VERSION) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_ARM_VERSION) && \ !defined(JSON_HEDLEY_CRAY_VERSION) && \ !defined(JSON_HEDLEY_TI_VERSION) && \ !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ !defined(__COMPCERT__) && \ !defined(JSON_HEDLEY_MCST_LCC_VERSION) #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION #endif #if defined(JSON_HEDLEY_GCC_VERSION_CHECK) #undef JSON_HEDLEY_GCC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_GCC_VERSION) #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) #undef JSON_HEDLEY_HAS_ATTRIBUTE #endif #if \ defined(__has_attribute) && \ ( \ (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ ) # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) #else # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE #endif #if defined(__has_attribute) #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #else #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE #endif #if defined(__has_attribute) #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #else #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE #endif #if \ defined(__has_cpp_attribute) && \ defined(__cplusplus) && \ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS #endif #if !defined(__cplusplus) || !defined(__has_cpp_attribute) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) #elif \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_IAR_VERSION) && \ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) #else #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE #endif #if defined(__has_cpp_attribute) && defined(__cplusplus) #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE #endif #if defined(__has_cpp_attribute) && defined(__cplusplus) #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_BUILTIN) #undef JSON_HEDLEY_HAS_BUILTIN #endif #if defined(__has_builtin) #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) #else #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) #undef JSON_HEDLEY_GNUC_HAS_BUILTIN #endif #if defined(__has_builtin) #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) #else #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) #undef JSON_HEDLEY_GCC_HAS_BUILTIN #endif #if defined(__has_builtin) #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) #else #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_FEATURE) #undef JSON_HEDLEY_HAS_FEATURE #endif #if defined(__has_feature) #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) #else #define JSON_HEDLEY_HAS_FEATURE(feature) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) #undef JSON_HEDLEY_GNUC_HAS_FEATURE #endif #if defined(__has_feature) #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) #else #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) #undef JSON_HEDLEY_GCC_HAS_FEATURE #endif #if defined(__has_feature) #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) #else #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_EXTENSION) #undef JSON_HEDLEY_HAS_EXTENSION #endif #if defined(__has_extension) #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) #else #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) #undef JSON_HEDLEY_GNUC_HAS_EXTENSION #endif #if defined(__has_extension) #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) #else #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) #undef JSON_HEDLEY_GCC_HAS_EXTENSION #endif #if defined(__has_extension) #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) #else #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_WARNING) #undef JSON_HEDLEY_HAS_WARNING #endif #if defined(__has_warning) #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) #else #define JSON_HEDLEY_HAS_WARNING(warning) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_WARNING) #undef JSON_HEDLEY_GNUC_HAS_WARNING #endif #if defined(__has_warning) #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) #else #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_WARNING) #undef JSON_HEDLEY_GCC_HAS_WARNING #endif #if defined(__has_warning) #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) #else #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ defined(__clang__) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_PRAGMA(value) __pragma(value) #else #define JSON_HEDLEY_PRAGMA(value) #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) #undef JSON_HEDLEY_DIAGNOSTIC_PUSH #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) #undef JSON_HEDLEY_DIAGNOSTIC_POP #endif #if defined(__clang__) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") #elif \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") #else #define JSON_HEDLEY_DIAGNOSTIC_PUSH #define JSON_HEDLEY_DIAGNOSTIC_POP #endif /* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ #endif #if defined(__cplusplus) # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") # if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP # endif # else # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP # endif # endif #endif #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x #endif #if defined(JSON_HEDLEY_CONST_CAST) #undef JSON_HEDLEY_CONST_CAST #endif #if defined(__cplusplus) # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) #elif \ JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ ((T) (expr)); \ JSON_HEDLEY_DIAGNOSTIC_POP \ })) #else # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) #endif #if defined(JSON_HEDLEY_REINTERPRET_CAST) #undef JSON_HEDLEY_REINTERPRET_CAST #endif #if defined(__cplusplus) #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) #else #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) #endif #if defined(JSON_HEDLEY_STATIC_CAST) #undef JSON_HEDLEY_STATIC_CAST #endif #if defined(__cplusplus) #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) #else #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) #endif #if defined(JSON_HEDLEY_CPP_CAST) #undef JSON_HEDLEY_CPP_CAST #endif #if defined(__cplusplus) # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") # define JSON_HEDLEY_CPP_CAST(T, expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ ((T) (expr)) \ JSON_HEDLEY_DIAGNOSTIC_POP # elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) # define JSON_HEDLEY_CPP_CAST(T, expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("diag_suppress=Pe137") \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) # endif #else # define JSON_HEDLEY_CPP_CAST(T, expr) (expr) #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED #endif #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") #elif \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) #elif \ JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") #elif \ JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #endif #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION #endif #if JSON_HEDLEY_HAS_WARNING("-Wunused-function") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION #endif #if defined(JSON_HEDLEY_DEPRECATED) #undef JSON_HEDLEY_DEPRECATED #endif #if defined(JSON_HEDLEY_DEPRECATED_FOR) #undef JSON_HEDLEY_DEPRECATED_FOR #endif #if \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) #elif \ (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) #elif defined(__cplusplus) && (__cplusplus >= 201402L) #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") #else #define JSON_HEDLEY_DEPRECATED(since) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) #endif #if defined(JSON_HEDLEY_UNAVAILABLE) #undef JSON_HEDLEY_UNAVAILABLE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) #else #define JSON_HEDLEY_UNAVAILABLE(available_since) #endif #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) #undef JSON_HEDLEY_WARN_UNUSED_RESULT #endif #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #elif defined(_Check_return_) /* SAL */ #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ #else #define JSON_HEDLEY_WARN_UNUSED_RESULT #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) #endif #if defined(JSON_HEDLEY_SENTINEL) #undef JSON_HEDLEY_SENTINEL #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) #else #define JSON_HEDLEY_SENTINEL(position) #endif #if defined(JSON_HEDLEY_NO_RETURN) #undef JSON_HEDLEY_NO_RETURN #endif #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_NO_RETURN __noreturn #elif \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define JSON_HEDLEY_NO_RETURN _Noreturn #elif defined(__cplusplus) && (__cplusplus >= 201103L) #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) #else #define JSON_HEDLEY_NO_RETURN #endif #if defined(JSON_HEDLEY_NO_ESCAPE) #undef JSON_HEDLEY_NO_ESCAPE #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) #else #define JSON_HEDLEY_NO_ESCAPE #endif #if defined(JSON_HEDLEY_UNREACHABLE) #undef JSON_HEDLEY_UNREACHABLE #endif #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) #undef JSON_HEDLEY_UNREACHABLE_RETURN #endif #if defined(JSON_HEDLEY_ASSUME) #undef JSON_HEDLEY_ASSUME #endif #if \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_ASSUME(expr) __assume(expr) #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) #elif \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) #if defined(__cplusplus) #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) #else #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) #endif #endif #if \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() #elif defined(JSON_HEDLEY_ASSUME) #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) #endif #if !defined(JSON_HEDLEY_ASSUME) #if defined(JSON_HEDLEY_UNREACHABLE) #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) #else #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) #endif #endif #if defined(JSON_HEDLEY_UNREACHABLE) #if \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) #else #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() #endif #else #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) #endif #if !defined(JSON_HEDLEY_UNREACHABLE) #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) #endif JSON_HEDLEY_DIAGNOSTIC_PUSH #if JSON_HEDLEY_HAS_WARNING("-Wpedantic") #pragma clang diagnostic ignored "-Wpedantic" #endif #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" #endif #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) #if defined(__clang__) #pragma clang diagnostic ignored "-Wvariadic-macros" #elif defined(JSON_HEDLEY_GCC_VERSION) #pragma GCC diagnostic ignored "-Wvariadic-macros" #endif #endif #if defined(JSON_HEDLEY_NON_NULL) #undef JSON_HEDLEY_NON_NULL #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) #else #define JSON_HEDLEY_NON_NULL(...) #endif JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_PRINTF_FORMAT) #undef JSON_HEDLEY_PRINTF_FORMAT #endif #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) #else #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) #endif #if defined(JSON_HEDLEY_CONSTEXPR) #undef JSON_HEDLEY_CONSTEXPR #endif #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) #endif #endif #if !defined(JSON_HEDLEY_CONSTEXPR) #define JSON_HEDLEY_CONSTEXPR #endif #if defined(JSON_HEDLEY_PREDICT) #undef JSON_HEDLEY_PREDICT #endif #if defined(JSON_HEDLEY_LIKELY) #undef JSON_HEDLEY_LIKELY #endif #if defined(JSON_HEDLEY_UNLIKELY) #undef JSON_HEDLEY_UNLIKELY #endif #if defined(JSON_HEDLEY_UNPREDICTABLE) #undef JSON_HEDLEY_UNPREDICTABLE #endif #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) #endif #if \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) # define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) #elif \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ (__extension__ ({ \ double hedley_probability_ = (probability); \ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ })) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ (__extension__ ({ \ double hedley_probability_ = (probability); \ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ })) # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) #else # define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) #endif #if !defined(JSON_HEDLEY_UNPREDICTABLE) #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) #endif #if defined(JSON_HEDLEY_MALLOC) #undef JSON_HEDLEY_MALLOC #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_MALLOC __declspec(restrict) #else #define JSON_HEDLEY_MALLOC #endif #if defined(JSON_HEDLEY_PURE) #undef JSON_HEDLEY_PURE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PURE __attribute__((__pure__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") #elif defined(__cplusplus) && \ ( \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ ) # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") #else # define JSON_HEDLEY_PURE #endif #if defined(JSON_HEDLEY_CONST) #undef JSON_HEDLEY_CONST #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_CONST __attribute__((__const__)) #elif \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_CONST _Pragma("no_side_effect") #else #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE #endif #if defined(JSON_HEDLEY_RESTRICT) #undef JSON_HEDLEY_RESTRICT #endif #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT restrict #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ defined(__clang__) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_RESTRICT __restrict #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT _Restrict #else #define JSON_HEDLEY_RESTRICT #endif #if defined(JSON_HEDLEY_INLINE) #undef JSON_HEDLEY_INLINE #endif #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ (defined(__cplusplus) && (__cplusplus >= 199711L)) #define JSON_HEDLEY_INLINE inline #elif \ defined(JSON_HEDLEY_GCC_VERSION) || \ JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) #define JSON_HEDLEY_INLINE __inline__ #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_INLINE __inline #else #define JSON_HEDLEY_INLINE #endif #if defined(JSON_HEDLEY_ALWAYS_INLINE) #undef JSON_HEDLEY_ALWAYS_INLINE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_ALWAYS_INLINE __forceinline #elif defined(__cplusplus) && \ ( \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ ) # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") #else # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE #endif #if defined(JSON_HEDLEY_NEVER_INLINE) #undef JSON_HEDLEY_NEVER_INLINE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) #else #define JSON_HEDLEY_NEVER_INLINE #endif #if defined(JSON_HEDLEY_PRIVATE) #undef JSON_HEDLEY_PRIVATE #endif #if defined(JSON_HEDLEY_PUBLIC) #undef JSON_HEDLEY_PUBLIC #endif #if defined(JSON_HEDLEY_IMPORT) #undef JSON_HEDLEY_IMPORT #endif #if defined(_WIN32) || defined(__CYGWIN__) # define JSON_HEDLEY_PRIVATE # define JSON_HEDLEY_PUBLIC __declspec(dllexport) # define JSON_HEDLEY_IMPORT __declspec(dllimport) #else # if \ JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ ( \ defined(__TI_EABI__) && \ ( \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ ) \ ) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) # else # define JSON_HEDLEY_PRIVATE # define JSON_HEDLEY_PUBLIC # endif # define JSON_HEDLEY_IMPORT extern #endif #if defined(JSON_HEDLEY_NO_THROW) #undef JSON_HEDLEY_NO_THROW #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) #define JSON_HEDLEY_NO_THROW __declspec(nothrow) #else #define JSON_HEDLEY_NO_THROW #endif #if defined(JSON_HEDLEY_FALL_THROUGH) #undef JSON_HEDLEY_FALL_THROUGH #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) #elif defined(__fallthrough) /* SAL */ #define JSON_HEDLEY_FALL_THROUGH __fallthrough #else #define JSON_HEDLEY_FALL_THROUGH #endif #if defined(JSON_HEDLEY_RETURNS_NON_NULL) #undef JSON_HEDLEY_RETURNS_NON_NULL #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) #elif defined(_Ret_notnull_) /* SAL */ #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ #else #define JSON_HEDLEY_RETURNS_NON_NULL #endif #if defined(JSON_HEDLEY_ARRAY_PARAM) #undef JSON_HEDLEY_ARRAY_PARAM #endif #if \ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ !defined(__STDC_NO_VLA__) && \ !defined(__cplusplus) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_TINYC_VERSION) #define JSON_HEDLEY_ARRAY_PARAM(name) (name) #else #define JSON_HEDLEY_ARRAY_PARAM(name) #endif #if defined(JSON_HEDLEY_IS_CONSTANT) #undef JSON_HEDLEY_IS_CONSTANT #endif #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) #undef JSON_HEDLEY_REQUIRE_CONSTEXPR #endif /* JSON_HEDLEY_IS_CONSTEXPR_ is for HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ #if defined(JSON_HEDLEY_IS_CONSTEXPR_) #undef JSON_HEDLEY_IS_CONSTEXPR_ #endif #if \ JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) #endif #if !defined(__cplusplus) # if \ JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) #if defined(__INTPTR_TYPE__) #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) #endif # elif \ ( \ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_IAR_VERSION)) || \ (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) #if defined(__INTPTR_TYPE__) #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) #endif # elif \ defined(JSON_HEDLEY_GCC_VERSION) || \ defined(JSON_HEDLEY_INTEL_VERSION) || \ defined(JSON_HEDLEY_TINYC_VERSION) || \ defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ defined(__clang__) # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ sizeof(void) != \ sizeof(*( \ 1 ? \ ((void*) ((expr) * 0L) ) : \ ((struct { char v[sizeof(void) * 2]; } *) 1) \ ) \ ) \ ) # endif #endif #if defined(JSON_HEDLEY_IS_CONSTEXPR_) #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) #endif #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) #else #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) (0) #endif #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) #endif #if defined(JSON_HEDLEY_BEGIN_C_DECLS) #undef JSON_HEDLEY_BEGIN_C_DECLS #endif #if defined(JSON_HEDLEY_END_C_DECLS) #undef JSON_HEDLEY_END_C_DECLS #endif #if defined(JSON_HEDLEY_C_DECL) #undef JSON_HEDLEY_C_DECL #endif #if defined(__cplusplus) #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { #define JSON_HEDLEY_END_C_DECLS } #define JSON_HEDLEY_C_DECL extern "C" #else #define JSON_HEDLEY_BEGIN_C_DECLS #define JSON_HEDLEY_END_C_DECLS #define JSON_HEDLEY_C_DECL #endif #if defined(JSON_HEDLEY_STATIC_ASSERT) #undef JSON_HEDLEY_STATIC_ASSERT #endif #if \ !defined(__cplusplus) && ( \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ defined(_Static_assert) \ ) # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) #elif \ (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) #else # define JSON_HEDLEY_STATIC_ASSERT(expr, message) #endif #if defined(JSON_HEDLEY_NULL) #undef JSON_HEDLEY_NULL #endif #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) #elif defined(NULL) #define JSON_HEDLEY_NULL NULL #else #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) #endif #elif defined(NULL) #define JSON_HEDLEY_NULL NULL #else #define JSON_HEDLEY_NULL ((void*) 0) #endif #if defined(JSON_HEDLEY_MESSAGE) #undef JSON_HEDLEY_MESSAGE #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") # define JSON_HEDLEY_MESSAGE(msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ JSON_HEDLEY_PRAGMA(message msg) \ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_MESSAGE(msg) #endif #if defined(JSON_HEDLEY_WARNING) #undef JSON_HEDLEY_WARNING #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") # define JSON_HEDLEY_WARNING(msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ JSON_HEDLEY_PRAGMA(clang warning msg) \ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) #endif #if defined(JSON_HEDLEY_REQUIRE) #undef JSON_HEDLEY_REQUIRE #endif #if defined(JSON_HEDLEY_REQUIRE_MSG) #undef JSON_HEDLEY_REQUIRE_MSG #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") # define JSON_HEDLEY_REQUIRE(expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(!(expr), #expr, "error"))) \ JSON_HEDLEY_DIAGNOSTIC_POP # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(!(expr), msg, "error"))) \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) # endif #else # define JSON_HEDLEY_REQUIRE(expr) # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) #endif #if defined(JSON_HEDLEY_FLAGS) #undef JSON_HEDLEY_FLAGS #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) #else #define JSON_HEDLEY_FLAGS #endif #if defined(JSON_HEDLEY_FLAGS_CAST) #undef JSON_HEDLEY_FLAGS_CAST #endif #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("warning(disable:188)") \ ((T) (expr)); \ JSON_HEDLEY_DIAGNOSTIC_POP \ })) #else # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) #endif #if defined(JSON_HEDLEY_EMPTY_BASES) #undef JSON_HEDLEY_EMPTY_BASES #endif #if \ (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) #else #define JSON_HEDLEY_EMPTY_BASES #endif /* Remaining macros are deprecated. */ #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK #endif #if defined(__clang__) #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) #else #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) #undef JSON_HEDLEY_CLANG_HAS_BUILTIN #endif #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) #undef JSON_HEDLEY_CLANG_HAS_FEATURE #endif #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) #undef JSON_HEDLEY_CLANG_HAS_EXTENSION #endif #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) #undef JSON_HEDLEY_CLANG_HAS_WARNING #endif #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ // This file contains all internal macro definitions (except those affecting ABI) // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them // #include // exclude unsupported compilers #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) #if defined(__clang__) #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif #endif // C++ language standard detection // if the user manually specified the used c++ version this is skipped #if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) #define JSON_HAS_CPP_20 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) #define JSON_HAS_CPP_14 #endif // the cpp 11 flag is always specified because it is the minimal required version #define JSON_HAS_CPP_11 #endif #ifdef __has_include #if __has_include() #include #endif #endif #if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) #ifdef JSON_HAS_CPP_17 #if defined(__cpp_lib_filesystem) #define JSON_HAS_FILESYSTEM 1 #elif defined(__cpp_lib_experimental_filesystem) #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #elif !defined(__has_include) #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #elif __has_include() #define JSON_HAS_FILESYSTEM 1 #elif __has_include() #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #endif // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support #if defined(__clang_major__) && __clang_major__ < 7 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support #if defined(_MSC_VER) && _MSC_VER < 1914 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before iOS 13 #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before macOS Catalina #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif #endif #endif #ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 #endif #ifndef JSON_HAS_FILESYSTEM #define JSON_HAS_FILESYSTEM 0 #endif #ifndef JSON_HAS_THREE_WAY_COMPARISON #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L #define JSON_HAS_THREE_WAY_COMPARISON 1 #else #define JSON_HAS_THREE_WAY_COMPARISON 0 #endif #endif #ifndef JSON_HAS_RANGES // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 #define JSON_HAS_RANGES 0 #elif defined(__cpp_lib_ranges) #define JSON_HAS_RANGES 1 #else #define JSON_HAS_RANGES 0 #endif #endif #ifndef JSON_HAS_STATIC_RTTI #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 #define JSON_HAS_STATIC_RTTI 1 #else #define JSON_HAS_STATIC_RTTI 0 #endif #endif #ifdef JSON_HAS_CPP_17 #define JSON_INLINE_VARIABLE inline #else #define JSON_INLINE_VARIABLE #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] #else #define JSON_NO_UNIQUE_ADDRESS #endif // disable documentation warnings on clang #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdocumentation" #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" #endif // allow disabling exceptions #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) #define JSON_THROW(exception) throw exception #define JSON_TRY try #define JSON_CATCH(exception) catch(exception) #define JSON_INTERNAL_CATCH(exception) catch(exception) #else #include #define JSON_THROW(exception) std::abort() #define JSON_TRY if(true) #define JSON_CATCH(exception) if(false) #define JSON_INTERNAL_CATCH(exception) if(false) #endif // override exception macros #if defined(JSON_THROW_USER) #undef JSON_THROW #define JSON_THROW JSON_THROW_USER #endif #if defined(JSON_TRY_USER) #undef JSON_TRY #define JSON_TRY JSON_TRY_USER #endif #if defined(JSON_CATCH_USER) #undef JSON_CATCH #define JSON_CATCH JSON_CATCH_USER #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_CATCH_USER #endif #if defined(JSON_INTERNAL_CATCH_USER) #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER #endif // allow overriding assert #if !defined(JSON_ASSERT) #include // assert #define JSON_ASSERT(x) assert(x) #endif // allow to access some private functions (needed by the test suite) #if defined(JSON_TESTS_PRIVATE) #define JSON_PRIVATE_UNLESS_TESTED public #else #define JSON_PRIVATE_UNLESS_TESTED private #endif /*! @brief macro to briefly define a mapping between an enum and JSON @def NLOHMANN_JSON_SERIALIZE_ENUM @since version 3.4.0 */ #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ template \ inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ { \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ [e](const std::pair& ej_pair) -> bool \ { \ return ej_pair.first == e; \ }); \ j = ((it != std::end(m)) ? it : std::begin(m))->second; \ } \ template \ inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ { \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ [&j](const std::pair& ej_pair) -> bool \ { \ return ej_pair.second == j; \ }); \ e = ((it != std::end(m)) ? it : std::begin(m))->first; \ } // Ugly macros to avoid uglier copy-paste when specializing basic_json. They // may be removed in the future once the class is split. #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ template class ObjectType, \ template class ArrayType, \ class StringType, class BooleanType, class NumberIntegerType, \ class NumberUnsignedType, class NumberFloatType, \ template class AllocatorType, \ template class JSONSerializer, \ class BinaryType, \ class CustomBaseClass> #define NLOHMANN_BASIC_JSON_TPL \ basic_json // Macros to simplify conversion from/to types #define NLOHMANN_JSON_EXPAND( x ) x #define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ NLOHMANN_JSON_PASTE64, \ NLOHMANN_JSON_PASTE63, \ NLOHMANN_JSON_PASTE62, \ NLOHMANN_JSON_PASTE61, \ NLOHMANN_JSON_PASTE60, \ NLOHMANN_JSON_PASTE59, \ NLOHMANN_JSON_PASTE58, \ NLOHMANN_JSON_PASTE57, \ NLOHMANN_JSON_PASTE56, \ NLOHMANN_JSON_PASTE55, \ NLOHMANN_JSON_PASTE54, \ NLOHMANN_JSON_PASTE53, \ NLOHMANN_JSON_PASTE52, \ NLOHMANN_JSON_PASTE51, \ NLOHMANN_JSON_PASTE50, \ NLOHMANN_JSON_PASTE49, \ NLOHMANN_JSON_PASTE48, \ NLOHMANN_JSON_PASTE47, \ NLOHMANN_JSON_PASTE46, \ NLOHMANN_JSON_PASTE45, \ NLOHMANN_JSON_PASTE44, \ NLOHMANN_JSON_PASTE43, \ NLOHMANN_JSON_PASTE42, \ NLOHMANN_JSON_PASTE41, \ NLOHMANN_JSON_PASTE40, \ NLOHMANN_JSON_PASTE39, \ NLOHMANN_JSON_PASTE38, \ NLOHMANN_JSON_PASTE37, \ NLOHMANN_JSON_PASTE36, \ NLOHMANN_JSON_PASTE35, \ NLOHMANN_JSON_PASTE34, \ NLOHMANN_JSON_PASTE33, \ NLOHMANN_JSON_PASTE32, \ NLOHMANN_JSON_PASTE31, \ NLOHMANN_JSON_PASTE30, \ NLOHMANN_JSON_PASTE29, \ NLOHMANN_JSON_PASTE28, \ NLOHMANN_JSON_PASTE27, \ NLOHMANN_JSON_PASTE26, \ NLOHMANN_JSON_PASTE25, \ NLOHMANN_JSON_PASTE24, \ NLOHMANN_JSON_PASTE23, \ NLOHMANN_JSON_PASTE22, \ NLOHMANN_JSON_PASTE21, \ NLOHMANN_JSON_PASTE20, \ NLOHMANN_JSON_PASTE19, \ NLOHMANN_JSON_PASTE18, \ NLOHMANN_JSON_PASTE17, \ NLOHMANN_JSON_PASTE16, \ NLOHMANN_JSON_PASTE15, \ NLOHMANN_JSON_PASTE14, \ NLOHMANN_JSON_PASTE13, \ NLOHMANN_JSON_PASTE12, \ NLOHMANN_JSON_PASTE11, \ NLOHMANN_JSON_PASTE10, \ NLOHMANN_JSON_PASTE9, \ NLOHMANN_JSON_PASTE8, \ NLOHMANN_JSON_PASTE7, \ NLOHMANN_JSON_PASTE6, \ NLOHMANN_JSON_PASTE5, \ NLOHMANN_JSON_PASTE4, \ NLOHMANN_JSON_PASTE3, \ NLOHMANN_JSON_PASTE2, \ NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) #define NLOHMANN_JSON_PASTE2(func, v1) func(v1) #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) #define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) #define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) #define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) #define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) #define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) #define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) #define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) #define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) #define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) #define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) #define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) #define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) #define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) #define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) #define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) #define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) #define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) #define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) #define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) #define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) #define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) #define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) #define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) #define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) #define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) #define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) #define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) #define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) #define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) #define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) #define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) #define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) #define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) #define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) #define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) #define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) #define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) #define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) #define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) #define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) #define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) #define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) #define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) #define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) #define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) #define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) #define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) #define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) #define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) #define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) #define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) #define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) #define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) #define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) #define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) #define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) #define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) #define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); #define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); /*! @brief macro @def NLOHMANN_DEFINE_TYPE_INTRUSIVE @since version 3.9.0 */ #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE @since version 3.9.0 */ #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } // inspired from https://stackoverflow.com/a/26745591 // allows to call any std function as if (e.g. with begin): // using std::begin; begin(x); // // it allows using the detected idiom to retrieve the return type // of such an expression #define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ namespace detail { \ using std::std_name; \ \ template \ using result_of_##std_name = decltype(std_name(std::declval()...)); \ } \ \ namespace detail2 { \ struct std_name##_tag \ { \ }; \ \ template \ std_name##_tag std_name(T&&...); \ \ template \ using result_of_##std_name = decltype(std_name(std::declval()...)); \ \ template \ struct would_call_std_##std_name \ { \ static constexpr auto const value = ::nlohmann::detail:: \ is_detected_exact::value; \ }; \ } /* namespace detail2 */ \ \ template \ struct would_call_std_##std_name : detail2::would_call_std_##std_name \ { \ } #ifndef JSON_USE_IMPLICIT_CONVERSIONS #define JSON_USE_IMPLICIT_CONVERSIONS 1 #endif #if JSON_USE_IMPLICIT_CONVERSIONS #define JSON_EXPLICIT #else #define JSON_EXPLICIT explicit #endif #ifndef JSON_DISABLE_ENUM_SERIALIZATION #define JSON_DISABLE_ENUM_SERIALIZATION 0 #endif #ifndef JSON_USE_GLOBAL_UDLS #define JSON_USE_GLOBAL_UDLS 1 #endif #if JSON_HAS_THREE_WAY_COMPARISON #include // partial_ordering #endif NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /////////////////////////// // JSON type enumeration // /////////////////////////// /*! @brief the JSON type enumeration This enumeration collects the different JSON types. It is internally used to distinguish the stored values, and the functions @ref basic_json::is_null(), @ref basic_json::is_object(), @ref basic_json::is_array(), @ref basic_json::is_string(), @ref basic_json::is_boolean(), @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and @ref basic_json::is_structured() rely on it. @note There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library distinguishes these three types for numbers: @ref basic_json::number_unsigned_t is used for unsigned integers, @ref basic_json::number_integer_t is used for signed integers, and @ref basic_json::number_float_t is used for floating-point numbers or to approximate integers which do not fit in the limits of their respective type. @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON value with the default value for a given type @since version 1.0.0 */ enum class value_t : std::uint8_t { null, ///< null value object, ///< object (unordered set of name/value pairs) array, ///< array (ordered collection of values) string, ///< string value boolean, ///< boolean value number_integer, ///< number value (signed integer) number_unsigned, ///< number value (unsigned integer) number_float, ///< number value (floating-point) binary, ///< binary array (ordered collection of bytes) discarded ///< discarded by the parser callback function }; /*! @brief comparison operator for JSON types Returns an ordering that is similar to Python: - order: null < boolean < number < object < array < string < binary - furthermore, each type is not smaller than itself - discarded values are not comparable - binary is represented as a b"" string in python and directly comparable to a string; however, making a binary array directly comparable with a string would be surprising behavior in a JSON file. @since version 1.0.0 */ #if JSON_HAS_THREE_WAY_COMPARISON inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* #else inline bool operator<(const value_t lhs, const value_t rhs) noexcept #endif { static constexpr std::array order = {{ 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, 6 /* binary */ } }; const auto l_index = static_cast(lhs); const auto r_index = static_cast(rhs); #if JSON_HAS_THREE_WAY_COMPARISON if (l_index < order.size() && r_index < order.size()) { return order[l_index] <=> order[r_index]; // *NOPAD* } return std::partial_ordering::unordered; #else return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; #endif } // GCC selects the built-in operator< over an operator rewritten from // a user-defined spaceship operator // Clang, MSVC, and ICC select the rewritten candidate // (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) #if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) inline bool operator<(const value_t lhs, const value_t rhs) noexcept { return std::is_lt(lhs <=> rhs); // *NOPAD* } #endif } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /*! @brief replace all occurrences of a substring by another string @param[in,out] s the string to manipulate; changed so that all occurrences of @a f are replaced with @a t @param[in] f the substring to replace with @a t @param[in] t the string to replace @a f @pre The search string @a f must not be empty. **This precondition is enforced with an assertion.** @since version 2.0.0 */ template inline void replace_substring(StringType& s, const StringType& f, const StringType& t) { JSON_ASSERT(!f.empty()); for (auto pos = s.find(f); // find first occurrence of f pos != StringType::npos; // make sure f was found s.replace(pos, f.size(), t), // replace with t, and pos = s.find(f, pos + t.size())) // find next occurrence of f {} } /*! * @brief string escaping as described in RFC 6901 (Sect. 4) * @param[in] s string to escape * @return escaped string * * Note the order of escaping "~" to "~0" and "/" to "~1" is important. */ template inline StringType escape(StringType s) { replace_substring(s, StringType{"~"}, StringType{"~0"}); replace_substring(s, StringType{"/"}, StringType{"~1"}); return s; } /*! * @brief string unescaping as described in RFC 6901 (Sect. 4) * @param[in] s string to unescape * @return unescaped string * * Note the order of escaping "~1" to "/" and "~0" to "~" is important. */ template static void unescape(StringType& s) { replace_substring(s, StringType{"~1"}, StringType{"/"}); replace_substring(s, StringType{"~0"}, StringType{"~"}); } } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // size_t // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /// struct to capture the start position of the current token struct position_t { /// the total number of characters read std::size_t chars_read_total = 0; /// the number of characters read in the current line std::size_t chars_read_current_line = 0; /// the number of lines read std::size_t lines_read = 0; /// conversion to size_t to preserve SAX interface constexpr operator size_t() const { return chars_read_total; } }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-FileCopyrightText: 2018 The Abseil Authors // SPDX-License-Identifier: MIT #include // array #include // size_t #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type #include // index_sequence, make_index_sequence, index_sequence_for // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template using uncvref_t = typename std::remove_cv::type>::type; #ifdef JSON_HAS_CPP_14 // the following utilities are natively available in C++14 using std::enable_if_t; using std::index_sequence; using std::make_index_sequence; using std::index_sequence_for; #else // alias templates to reduce boilerplate template using enable_if_t = typename std::enable_if::type; // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. //// START OF CODE FROM GOOGLE ABSEIL // integer_sequence // // Class template representing a compile-time integer sequence. An instantiation // of `integer_sequence` has a sequence of integers encoded in its // type through its template arguments (which is a common need when // working with C++11 variadic templates). `absl::integer_sequence` is designed // to be a drop-in replacement for C++14's `std::integer_sequence`. // // Example: // // template< class T, T... Ints > // void user_function(integer_sequence); // // int main() // { // // user_function's `T` will be deduced to `int` and `Ints...` // // will be deduced to `0, 1, 2, 3, 4`. // user_function(make_integer_sequence()); // } template struct integer_sequence { using value_type = T; static constexpr std::size_t size() noexcept { return sizeof...(Ints); } }; // index_sequence // // A helper template for an `integer_sequence` of `size_t`, // `absl::index_sequence` is designed to be a drop-in replacement for C++14's // `std::index_sequence`. template using index_sequence = integer_sequence; namespace utility_internal { template struct Extend; // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. template struct Extend, SeqSize, 0> { using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; }; template struct Extend, SeqSize, 1> { using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; }; // Recursion helper for 'make_integer_sequence'. // 'Gen::type' is an alias for 'integer_sequence'. template struct Gen { using type = typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; }; template struct Gen { using type = integer_sequence; }; } // namespace utility_internal // Compile-time sequences of integers // make_integer_sequence // // This template alias is equivalent to // `integer_sequence`, and is designed to be a drop-in // replacement for C++14's `std::make_integer_sequence`. template using make_integer_sequence = typename utility_internal::Gen::type; // make_index_sequence // // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, // and is designed to be a drop-in replacement for C++14's // `std::make_index_sequence`. template using make_index_sequence = make_integer_sequence; // index_sequence_for // // Converts a typename pack into an index sequence of the same length, and // is designed to be a drop-in replacement for C++14's // `std::index_sequence_for()` template using index_sequence_for = make_index_sequence; //// END OF CODE FROM GOOGLE ABSEIL #endif // dispatch utility (taken from ranges-v3) template struct priority_tag : priority_tag < N - 1 > {}; template<> struct priority_tag<0> {}; // taken from ranges-v3 template struct static_const { static JSON_INLINE_VARIABLE constexpr T value{}; }; #ifndef JSON_HAS_CPP_17 template constexpr T static_const::value; #endif template inline constexpr std::array make_array(Args&& ... args) { return std::array {{static_cast(std::forward(args))...}}; } } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // numeric_limits #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval #include // tuple #include // char_traits // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // random_access_iterator_tag // #include // #include // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template struct iterator_types {}; template struct iterator_types < It, void_t> { using difference_type = typename It::difference_type; using value_type = typename It::value_type; using pointer = typename It::pointer; using reference = typename It::reference; using iterator_category = typename It::iterator_category; }; // This is required as some compilers implement std::iterator_traits in a way that // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. template struct iterator_traits { }; template struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> : iterator_types { }; template struct iterator_traits::value>> { using iterator_category = std::random_access_iterator_tag; using value_type = T; using difference_type = ptrdiff_t; using pointer = T*; using reference = T&; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); NLOHMANN_JSON_NAMESPACE_END // #include // #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ #include // int64_t, uint64_t #include // map #include // allocator #include // string #include // vector // #include /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @since version 1.0.0 */ NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief default JSONSerializer template argument This serializer ignores the template arguments and uses ADL ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) for serialization. */ template struct adl_serializer; /// a class to store JSON values /// @sa https://json.nlohmann.me/api/basic_json/ template class ObjectType = std::map, template class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template class AllocatorType = std::allocator, template class JSONSerializer = adl_serializer, class BinaryType = std::vector, // cppcheck-suppress syntaxError class CustomBaseClass = void> class basic_json; /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document /// @sa https://json.nlohmann.me/api/json_pointer/ template class json_pointer; /*! @brief default specialization @sa https://json.nlohmann.me/api/json/ */ using json = basic_json<>; /// @brief a minimal map-like container that preserves insertion order /// @sa https://json.nlohmann.me/api/ordered_map/ template struct ordered_map; /// @brief specialization that maintains the insertion order of object keys /// @sa https://json.nlohmann.me/api/ordered_json/ using ordered_json = basic_json; NLOHMANN_JSON_NAMESPACE_END #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief detail namespace with internal helper functions This namespace collects functions that should not be exposed, implementations of some @ref basic_json methods, and meta-programming helpers. @since version 2.1.0 */ namespace detail { ///////////// // helpers // ///////////// // Note to maintainers: // // Every trait in this file expects a non CV-qualified type. // The only exceptions are in the 'aliases for detected' section // (i.e. those of the form: decltype(T::member_function(std::declval()))) // // In this case, T has to be properly CV-qualified to constraint the function arguments // (e.g. to_json(BasicJsonType&, const T&)) template struct is_basic_json : std::false_type {}; NLOHMANN_BASIC_JSON_TPL_DECLARATION struct is_basic_json : std::true_type {}; // used by exceptions create() member functions // true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t // false_type otherwise template struct is_basic_json_context : std::integral_constant < bool, is_basic_json::type>::type>::value || std::is_same::value > {}; ////////////////////// // json_ref helpers // ////////////////////// template class json_ref; template struct is_json_ref : std::false_type {}; template struct is_json_ref> : std::true_type {}; ////////////////////////// // aliases for detected // ////////////////////////// template using mapped_type_t = typename T::mapped_type; template using key_type_t = typename T::key_type; template using value_type_t = typename T::value_type; template using difference_type_t = typename T::difference_type; template using pointer_t = typename T::pointer; template using reference_t = typename T::reference; template using iterator_category_t = typename T::iterator_category; template using to_json_function = decltype(T::to_json(std::declval()...)); template using from_json_function = decltype(T::from_json(std::declval()...)); template using get_template_function = decltype(std::declval().template get()); // trait checking if JSONSerializer::from_json(json const&, udt&) exists template struct has_from_json : std::false_type {}; // trait checking if j.get is valid // use this trait instead of std::is_constructible or std::is_convertible, // both rely on, or make use of implicit conversions, and thus fail when T // has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) template struct is_getable { static constexpr bool value = is_detected::value; }; template struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; // This trait checks if JSONSerializer::from_json(json const&) exists // this overload is used for non-default-constructible user-defined-types template struct has_non_default_from_json : std::false_type {}; template struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; // This trait checks if BasicJsonType::json_serializer::to_json exists // Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. template struct has_to_json : std::false_type {}; template struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; template using detect_key_compare = typename T::key_compare; template struct has_key_compare : std::integral_constant::value> {}; // obtains the actual object key comparator template struct actual_object_comparator { using object_t = typename BasicJsonType::object_t; using object_comparator_t = typename BasicJsonType::default_object_comparator_t; using type = typename std::conditional < has_key_compare::value, typename object_t::key_compare, object_comparator_t>::type; }; template using actual_object_comparator_t = typename actual_object_comparator::type; ///////////////// // char_traits // ///////////////// // Primary template of char_traits calls std char_traits template struct char_traits : std::char_traits {}; // Explicitly define char traits for unsigned char since it is not standard template<> struct char_traits : std::char_traits { using char_type = unsigned char; using int_type = uint64_t; // Redefine to_int_type function static int_type to_int_type(char_type c) noexcept { return static_cast(c); } static char_type to_char_type(int_type i) noexcept { return static_cast(i); } static constexpr int_type eof() noexcept { return static_cast(EOF); } }; // Explicitly define char traits for signed char since it is not standard template<> struct char_traits : std::char_traits { using char_type = signed char; using int_type = uint64_t; // Redefine to_int_type function static int_type to_int_type(char_type c) noexcept { return static_cast(c); } static char_type to_char_type(int_type i) noexcept { return static_cast(i); } static constexpr int_type eof() noexcept { return static_cast(EOF); } }; /////////////////// // is_ functions // /////////////////// // https://en.cppreference.com/w/cpp/types/conjunction template struct conjunction : std::true_type { }; template struct conjunction : B { }; template struct conjunction : std::conditional(B::value), conjunction, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { }; // Reimplementation of is_constructible and is_default_constructible, due to them being broken for // std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). // This causes compile errors in e.g. clang 3.5 or gcc 4.9. template struct is_default_constructible : std::is_default_constructible {}; template struct is_default_constructible> : conjunction, is_default_constructible> {}; template struct is_default_constructible> : conjunction, is_default_constructible> {}; template struct is_default_constructible> : conjunction...> {}; template struct is_default_constructible> : conjunction...> {}; template struct is_constructible : std::is_constructible {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_iterator_traits : std::false_type {}; template struct is_iterator_traits> { private: using traits = iterator_traits; public: static constexpr auto value = is_detected::value && is_detected::value && is_detected::value && is_detected::value && is_detected::value; }; template struct is_range { private: using t_ref = typename std::add_lvalue_reference::type; using iterator = detected_t; using sentinel = detected_t; // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator // and https://en.cppreference.com/w/cpp/iterator/sentinel_for // but reimplementing these would be too much work, as a lot of other concepts are used underneath static constexpr auto is_iterator_begin = is_iterator_traits>::value; public: static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; }; template using iterator_t = enable_if_t::value, result_of_begin())>>; template using range_value_t = value_type_t>>; // The following implementation of is_complete_type is taken from // https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ // and is written by Xiang Fan who agreed to using it in this library. template struct is_complete_type : std::false_type {}; template struct is_complete_type : std::true_type {}; template struct is_compatible_object_type_impl : std::false_type {}; template struct is_compatible_object_type_impl < BasicJsonType, CompatibleObjectType, enable_if_t < is_detected::value&& is_detected::value >> { using object_t = typename BasicJsonType::object_t; // macOS's is_constructible does not play well with nonesuch... static constexpr bool value = is_constructible::value && is_constructible::value; }; template struct is_compatible_object_type : is_compatible_object_type_impl {}; template struct is_constructible_object_type_impl : std::false_type {}; template struct is_constructible_object_type_impl < BasicJsonType, ConstructibleObjectType, enable_if_t < is_detected::value&& is_detected::value >> { using object_t = typename BasicJsonType::object_t; static constexpr bool value = (is_default_constructible::value && (std::is_move_assignable::value || std::is_copy_assignable::value) && (is_constructible::value && std::is_same < typename object_t::mapped_type, typename ConstructibleObjectType::mapped_type >::value)) || (has_from_json::value || has_non_default_from_json < BasicJsonType, typename ConstructibleObjectType::mapped_type >::value); }; template struct is_constructible_object_type : is_constructible_object_type_impl {}; template struct is_compatible_string_type { static constexpr auto value = is_constructible::value; }; template struct is_constructible_string_type { // launder type through decltype() to fix compilation failure on ICPC #ifdef __INTEL_COMPILER using laundered_type = decltype(std::declval()); #else using laundered_type = ConstructibleStringType; #endif static constexpr auto value = conjunction < is_constructible, is_detected_exact>::value; }; template struct is_compatible_array_type_impl : std::false_type {}; template struct is_compatible_array_type_impl < BasicJsonType, CompatibleArrayType, enable_if_t < is_detected::value&& is_iterator_traits>>::value&& // special case for types like std::filesystem::path whose iterator's value_type are themselves // c.f. https://github.com/nlohmann/json/pull/3073 !std::is_same>::value >> { static constexpr bool value = is_constructible>::value; }; template struct is_compatible_array_type : is_compatible_array_type_impl {}; template struct is_constructible_array_type_impl : std::false_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t::value >> : std::true_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t < !std::is_same::value&& !is_compatible_string_type::value&& is_default_constructible::value&& (std::is_move_assignable::value || std::is_copy_assignable::value)&& is_detected::value&& is_iterator_traits>>::value&& is_detected::value&& // special case for types like std::filesystem::path whose iterator's value_type are themselves // c.f. https://github.com/nlohmann/json/pull/3073 !std::is_same>::value&& is_complete_type < detected_t>::value >> { using value_type = range_value_t; static constexpr bool value = std::is_same::value || has_from_json::value || has_non_default_from_json < BasicJsonType, value_type >::value; }; template struct is_constructible_array_type : is_constructible_array_type_impl {}; template struct is_compatible_integer_type_impl : std::false_type {}; template struct is_compatible_integer_type_impl < RealIntegerType, CompatibleNumberIntegerType, enable_if_t < std::is_integral::value&& std::is_integral::value&& !std::is_same::value >> { // is there an assert somewhere on overflows? using RealLimits = std::numeric_limits; using CompatibleLimits = std::numeric_limits; static constexpr auto value = is_constructible::value && CompatibleLimits::is_integer && RealLimits::is_signed == CompatibleLimits::is_signed; }; template struct is_compatible_integer_type : is_compatible_integer_type_impl {}; template struct is_compatible_type_impl: std::false_type {}; template struct is_compatible_type_impl < BasicJsonType, CompatibleType, enable_if_t::value >> { static constexpr bool value = has_to_json::value; }; template struct is_compatible_type : is_compatible_type_impl {}; template struct is_constructible_tuple : std::false_type {}; template struct is_constructible_tuple> : conjunction...> {}; template struct is_json_iterator_of : std::false_type {}; template struct is_json_iterator_of : std::true_type {}; template struct is_json_iterator_of : std::true_type {}; // checks if a given type T is a template specialization of Primary template