react-nitro-yoga 0.0.0-stage → 0.0.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (529) hide show
  1. package/Generated/.gitattributes +1 -0
  2. package/Generated/api.d.ts +100 -0
  3. package/Generated/ffigen_yoga_adapters.h +52 -0
  4. package/Generated/native.d.ts +84 -0
  5. package/Generated/native.ts +283 -0
  6. package/Generated/yoga.c +1087 -0
  7. package/LICENSE +21 -0
  8. package/Package.swift +57 -0
  9. package/README.md +61 -2
  10. package/Sources/ReactNitroYoga/InstallHermesBindings.cpp +11 -0
  11. package/Sources/ReactNitroYoga/SHUnit.h +16 -0
  12. package/include/ReactNitroYoga/InstallHermesBindings.hpp +12 -0
  13. package/package.json +26 -4
  14. package/yoga/.clang-format +109 -0
  15. package/yoga/.clang-tidy +217 -0
  16. package/yoga/.editorconfig +11 -0
  17. package/yoga/.eslintrc.cjs +84 -0
  18. package/yoga/.github/ISSUE_TEMPLATE.md +21 -0
  19. package/yoga/.github/actions/black/action.yml +25 -0
  20. package/yoga/.github/actions/cache-emsdk/action.yml +10 -0
  21. package/yoga/.github/actions/install-ninja/action.yml +14 -0
  22. package/yoga/.github/actions/setup-android/action.yml +12 -0
  23. package/yoga/.github/actions/setup-apple/action.yml +8 -0
  24. package/yoga/.github/actions/setup-cpp/action.yml +34 -0
  25. package/yoga/.github/actions/setup-js/action.yml +18 -0
  26. package/yoga/.github/workflows/publish-android-release.yml +38 -0
  27. package/yoga/.github/workflows/publish-android-snashot.yml +36 -0
  28. package/yoga/.github/workflows/publish-npm-release.yml +25 -0
  29. package/yoga/.github/workflows/validate-android.yml +30 -0
  30. package/yoga/.github/workflows/validate-cpp.yml +101 -0
  31. package/yoga/.github/workflows/validate-format.yml +36 -0
  32. package/yoga/.github/workflows/validate-js.yml +119 -0
  33. package/yoga/.github/workflows/validate-swiftpm.yml +29 -0
  34. package/yoga/.github/workflows/validate-tests.yml +35 -0
  35. package/yoga/.github/workflows/validate-website.yml +45 -0
  36. package/yoga/.prettierignore +3 -0
  37. package/yoga/.prettierrc.js +16 -0
  38. package/yoga/.vscode/extensions.json +7 -0
  39. package/yoga/.vscode/launch.json +25 -0
  40. package/yoga/.vscode/settings.json +20 -0
  41. package/yoga/.vscode/tasks.json +23 -0
  42. package/yoga/CMakeLists.txt +58 -0
  43. package/yoga/CODE_OF_CONDUCT.md +76 -0
  44. package/yoga/CONTRIBUTING.md +44 -0
  45. package/yoga/LICENSE +21 -0
  46. package/yoga/LICENSE-examples +9 -0
  47. package/yoga/Package.swift +32 -0
  48. package/yoga/README.md +36 -0
  49. package/yoga/benchmark/Benchmark.cpp +400 -0
  50. package/yoga/benchmark/Benchmark.h +39 -0
  51. package/yoga/benchmark/CMakeLists.txt +27 -0
  52. package/yoga/benchmark/TreeDeserialization.cpp +248 -0
  53. package/yoga/benchmark/TreeDeserialization.h +52 -0
  54. package/yoga/benchmark/YGBenchmark.c +183 -0
  55. package/yoga/benchmark/benchmark +15 -0
  56. package/yoga/benchmark/captures/chat-mac.json +24426 -0
  57. package/yoga/benchmark/captures/feed-android.json +10335 -0
  58. package/yoga/benchmark/captures/profile-ios.json +1955 -0
  59. package/yoga/benchmark/captures/rendering-sample-mac.json +1927 -0
  60. package/yoga/build.gradle +46 -0
  61. package/yoga/build_fuzz_tests +28 -0
  62. package/yoga/capture/CMakeLists.txt +23 -0
  63. package/yoga/capture/CaptureTree.cpp +100 -0
  64. package/yoga/capture/CaptureTree.h +47 -0
  65. package/yoga/capture/NodeToString.cpp +359 -0
  66. package/yoga/capture/NodeToString.h +40 -0
  67. package/yoga/cmake/project-defaults.cmake +50 -0
  68. package/yoga/cmake/yoga-config.cmake.in +10 -0
  69. package/yoga/enums.py +394 -0
  70. package/yoga/fuzz/CMakeLists.txt +21 -0
  71. package/yoga/fuzz/FuzzLayout.cpp +57 -0
  72. package/yoga/gentest/babel.config.cjs +12 -0
  73. package/yoga/gentest/fixtures/YGAbsolutePositionTest.html +168 -0
  74. package/yoga/gentest/fixtures/YGAlignContentTest.html +479 -0
  75. package/yoga/gentest/fixtures/YGAlignItemsTest.html +227 -0
  76. package/yoga/gentest/fixtures/YGAlignSelfTest.html +23 -0
  77. package/yoga/gentest/fixtures/YGAndroidNewsFeed.html +28 -0
  78. package/yoga/gentest/fixtures/YGAspectRatioTest.html +3 -0
  79. package/yoga/gentest/fixtures/YGAutoTest.html +25 -0
  80. package/yoga/gentest/fixtures/YGBorderTest.html +18 -0
  81. package/yoga/gentest/fixtures/YGBoxSizingTest.html +240 -0
  82. package/yoga/gentest/fixtures/YGDimensionTest.html +9 -0
  83. package/yoga/gentest/fixtures/YGDisplayTest.html +89 -0
  84. package/yoga/gentest/fixtures/YGFlexBasisFitContentTest.html +55 -0
  85. package/yoga/gentest/fixtures/YGFlexDirectionTest.html +391 -0
  86. package/yoga/gentest/fixtures/YGFlexTest.html +53 -0
  87. package/yoga/gentest/fixtures/YGFlexWrapTest.html +160 -0
  88. package/yoga/gentest/fixtures/YGGapTest.html +233 -0
  89. package/yoga/gentest/fixtures/YGIntrinsicSizeTest.html +295 -0
  90. package/yoga/gentest/fixtures/YGJustifyContentTest.html +164 -0
  91. package/yoga/gentest/fixtures/YGMarginTest.html +157 -0
  92. package/yoga/gentest/fixtures/YGMinMaxDimensionTest.html +116 -0
  93. package/yoga/gentest/fixtures/YGPaddingTest.html +29 -0
  94. package/yoga/gentest/fixtures/YGPercentageTest.html +125 -0
  95. package/yoga/gentest/fixtures/YGRoundingTest.html +95 -0
  96. package/yoga/gentest/fixtures/YGSizeOverflowTest.html +17 -0
  97. package/yoga/gentest/fixtures/YGStaticPositionTest.html +712 -0
  98. package/yoga/gentest/fonts/Ahem.ttf +0 -0
  99. package/yoga/gentest/gentest-driver.ts +141 -0
  100. package/yoga/gentest/gentest-validate.ts +43 -0
  101. package/yoga/gentest/package.json +24 -0
  102. package/yoga/gentest/scripts/gentest-validate.ts +43 -0
  103. package/yoga/gentest/signedsource.d.ts +10 -0
  104. package/yoga/gentest/src/ChromePool.ts +78 -0
  105. package/yoga/gentest/src/CssToYoga.ts +958 -0
  106. package/yoga/gentest/src/buildLayoutTree.ts +98 -0
  107. package/yoga/gentest/src/cli.ts +163 -0
  108. package/yoga/gentest/src/emitters/CppEmitter.ts +452 -0
  109. package/yoga/gentest/src/emitters/Emitter.ts +204 -0
  110. package/yoga/gentest/src/emitters/JavaEmitter.ts +469 -0
  111. package/yoga/gentest/src/emitters/JavascriptEmitter.ts +353 -0
  112. package/yoga/gentest/src/types.ts +41 -0
  113. package/yoga/gentest/test-template.html +42 -0
  114. package/yoga/gentest/tsconfig.json +13 -0
  115. package/yoga/gradle/wrapper/gradle-wrapper.jar +0 -0
  116. package/yoga/gradle/wrapper/gradle-wrapper.properties +7 -0
  117. package/yoga/gradle.properties +14 -0
  118. package/yoga/gradlew +251 -0
  119. package/yoga/gradlew.bat +94 -0
  120. package/yoga/java/AndroidManifest.xml +14 -0
  121. package/yoga/java/CMakeLists.txt +22 -0
  122. package/yoga/java/build.gradle.kts +127 -0
  123. package/yoga/java/com/facebook/yoga/LayoutPassReason.kt +35 -0
  124. package/yoga/java/com/facebook/yoga/YogaAlign.kt +45 -0
  125. package/yoga/java/com/facebook/yoga/YogaBaselineFunction.kt +16 -0
  126. package/yoga/java/com/facebook/yoga/YogaBoxSizing.kt +27 -0
  127. package/yoga/java/com/facebook/yoga/YogaConfig.kt +48 -0
  128. package/yoga/java/com/facebook/yoga/YogaConfigFactory.kt +12 -0
  129. package/yoga/java/com/facebook/yoga/YogaConfigJNIBase.kt +70 -0
  130. package/yoga/java/com/facebook/yoga/YogaConfigJNIFinalizer.kt +30 -0
  131. package/yoga/java/com/facebook/yoga/YogaConstants.kt +18 -0
  132. package/yoga/java/com/facebook/yoga/YogaDimension.kt +27 -0
  133. package/yoga/java/com/facebook/yoga/YogaDirection.kt +29 -0
  134. package/yoga/java/com/facebook/yoga/YogaDisplay.kt +31 -0
  135. package/yoga/java/com/facebook/yoga/YogaEdge.kt +41 -0
  136. package/yoga/java/com/facebook/yoga/YogaErrata.kt +39 -0
  137. package/yoga/java/com/facebook/yoga/YogaExperimentalFeature.kt +27 -0
  138. package/yoga/java/com/facebook/yoga/YogaFlexDirection.kt +31 -0
  139. package/yoga/java/com/facebook/yoga/YogaGridTrackType.kt +33 -0
  140. package/yoga/java/com/facebook/yoga/YogaGutter.kt +29 -0
  141. package/yoga/java/com/facebook/yoga/YogaJustify.kt +43 -0
  142. package/yoga/java/com/facebook/yoga/YogaLayoutType.kt +27 -0
  143. package/yoga/java/com/facebook/yoga/YogaLogLevel.kt +39 -0
  144. package/yoga/java/com/facebook/yoga/YogaLogger.kt +19 -0
  145. package/yoga/java/com/facebook/yoga/YogaMeasureFunction.kt +19 -0
  146. package/yoga/java/com/facebook/yoga/YogaMeasureMode.kt +29 -0
  147. package/yoga/java/com/facebook/yoga/YogaMeasureOutput.kt +29 -0
  148. package/yoga/java/com/facebook/yoga/YogaNative.kt +347 -0
  149. package/yoga/java/com/facebook/yoga/YogaNode.kt +254 -0
  150. package/yoga/java/com/facebook/yoga/YogaNodeFactory.kt +14 -0
  151. package/yoga/java/com/facebook/yoga/YogaNodeJNIBase.kt +762 -0
  152. package/yoga/java/com/facebook/yoga/YogaNodeJNIFinalizer.kt +33 -0
  153. package/yoga/java/com/facebook/yoga/YogaNodeType.kt +27 -0
  154. package/yoga/java/com/facebook/yoga/YogaOverflow.kt +29 -0
  155. package/yoga/java/com/facebook/yoga/YogaPositionType.kt +29 -0
  156. package/yoga/java/com/facebook/yoga/YogaProps.kt +205 -0
  157. package/yoga/java/com/facebook/yoga/YogaStyleInputs.kt +51 -0
  158. package/yoga/java/com/facebook/yoga/YogaUnit.kt +37 -0
  159. package/yoga/java/com/facebook/yoga/YogaValue.kt +66 -0
  160. package/yoga/java/com/facebook/yoga/YogaWrap.kt +29 -0
  161. package/yoga/java/com/facebook/yoga/annotations/DoNotStrip.kt +19 -0
  162. package/yoga/java/gen/com/facebook/yoga/BuildConfig.java +15 -0
  163. package/yoga/java/jni/LayoutContext.cpp +34 -0
  164. package/yoga/java/jni/LayoutContext.h +29 -0
  165. package/yoga/java/jni/ScopedGlobalRef.h +140 -0
  166. package/yoga/java/jni/ScopedLocalRef.h +141 -0
  167. package/yoga/java/jni/YGJNI.h +77 -0
  168. package/yoga/java/jni/YGJNIVanilla.cpp +1178 -0
  169. package/yoga/java/jni/YGJNIVanilla.h +12 -0
  170. package/yoga/java/jni/YGJTypesVanilla.h +52 -0
  171. package/yoga/java/jni/YogaJniException.cpp +49 -0
  172. package/yoga/java/jni/YogaJniException.h +35 -0
  173. package/yoga/java/jni/common.cpp +109 -0
  174. package/yoga/java/jni/common.h +73 -0
  175. package/yoga/java/jni/corefunctions.cpp +91 -0
  176. package/yoga/java/jni/corefunctions.h +50 -0
  177. package/yoga/java/jni/macros.h +23 -0
  178. package/yoga/java/jni/tests/corefunctionsTest.cpp +247 -0
  179. package/yoga/java/jni/yogajni.cpp +18 -0
  180. package/yoga/java/proguard-rules.pro +10 -0
  181. package/yoga/java/res/values/strings.xml +12 -0
  182. package/yoga/java/tests/com/facebook/yoga/TestParametrization.kt +29 -0
  183. package/yoga/java/tests/com/facebook/yoga/YGAlignBaselineTest.kt +117 -0
  184. package/yoga/java/tests/com/facebook/yoga/YogaExceptionTest.kt +140 -0
  185. package/yoga/java/tests/com/facebook/yoga/YogaLoggerTest.kt +77 -0
  186. package/yoga/java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.kt +1020 -0
  187. package/yoga/java/tests/com/facebook/yoga/YogaNodeTest.kt +319 -0
  188. package/yoga/java/tests/com/facebook/yoga/YogaValueTest.kt +23 -0
  189. package/yoga/java/tests/com/facebook/yoga/utils/TestUtils.kt +99 -0
  190. package/yoga/java/tests/generated/com/facebook/yoga/YGAbsolutePositionTest.java +1670 -0
  191. package/yoga/java/tests/generated/com/facebook/yoga/YGAlignContentTest.java +5440 -0
  192. package/yoga/java/tests/generated/com/facebook/yoga/YGAlignItemsTest.java +2132 -0
  193. package/yoga/java/tests/generated/com/facebook/yoga/YGAlignSelfTest.java +271 -0
  194. package/yoga/java/tests/generated/com/facebook/yoga/YGAndroidNewsFeed.java +313 -0
  195. package/yoga/java/tests/generated/com/facebook/yoga/YGAspectRatioTest.java +73 -0
  196. package/yoga/java/tests/generated/com/facebook/yoga/YGAutoTest.java +326 -0
  197. package/yoga/java/tests/generated/com/facebook/yoga/YGBorderTest.java +222 -0
  198. package/yoga/java/tests/generated/com/facebook/yoga/YGBoxSizingTest.java +2165 -0
  199. package/yoga/java/tests/generated/com/facebook/yoga/YGDimensionTest.java +122 -0
  200. package/yoga/java/tests/generated/com/facebook/yoga/YGDisplayContentsTest.java +107 -0
  201. package/yoga/java/tests/generated/com/facebook/yoga/YGDisplayTest.java +1021 -0
  202. package/yoga/java/tests/generated/com/facebook/yoga/YGFlexBasisFitContentTest.java +391 -0
  203. package/yoga/java/tests/generated/com/facebook/yoga/YGFlexDirectionTest.java +4118 -0
  204. package/yoga/java/tests/generated/com/facebook/yoga/YGFlexTest.java +630 -0
  205. package/yoga/java/tests/generated/com/facebook/yoga/YGFlexWrapTest.java +1863 -0
  206. package/yoga/java/tests/generated/com/facebook/yoga/YGGapTest.java +2988 -0
  207. package/yoga/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java +926 -0
  208. package/yoga/java/tests/generated/com/facebook/yoga/YGJustifyContentTest.java +1865 -0
  209. package/yoga/java/tests/generated/com/facebook/yoga/YGMarginTest.java +1796 -0
  210. package/yoga/java/tests/generated/com/facebook/yoga/YGMinMaxDimensionTest.java +1210 -0
  211. package/yoga/java/tests/generated/com/facebook/yoga/YGPaddingTest.java +307 -0
  212. package/yoga/java/tests/generated/com/facebook/yoga/YGPercentageTest.java +1345 -0
  213. package/yoga/java/tests/generated/com/facebook/yoga/YGRoundingTest.java +1099 -0
  214. package/yoga/java/tests/generated/com/facebook/yoga/YGSizeOverflowTest.java +195 -0
  215. package/yoga/java/tests/generated/com/facebook/yoga/YGStaticPositionTest.java +5992 -0
  216. package/yoga/java/yogajni.version +13 -0
  217. package/yoga/javascript/CMakeLists.txt +59 -0
  218. package/yoga/javascript/README.md +27 -0
  219. package/yoga/javascript/babel.config.cjs +30 -0
  220. package/yoga/javascript/jest.config.js +14 -0
  221. package/yoga/javascript/jest.setup.js +12 -0
  222. package/yoga/javascript/just.config.cjs +258 -0
  223. package/yoga/javascript/package.json +52 -0
  224. package/yoga/javascript/src/generated/YGEnums.ts +249 -0
  225. package/yoga/javascript/src/index.ts +23 -0
  226. package/yoga/javascript/src/load.ts +25 -0
  227. package/yoga/javascript/src/wasm_bridge.c +155 -0
  228. package/yoga/javascript/src/wrapAssembly.ts +1025 -0
  229. package/yoga/javascript/tests/Benchmarks/YGBenchmark.test.ts +110 -0
  230. package/yoga/javascript/tests/YGAlignBaselineTest.test.ts +104 -0
  231. package/yoga/javascript/tests/YGComputedBorderTest.test.ts +25 -0
  232. package/yoga/javascript/tests/YGComputedMarginTest.test.ts +25 -0
  233. package/yoga/javascript/tests/YGComputedPaddingTest.test.ts +25 -0
  234. package/yoga/javascript/tests/YGDirtiedTest.test.ts +149 -0
  235. package/yoga/javascript/tests/YGErrataTest.test.ts +34 -0
  236. package/yoga/javascript/tests/YGFlexBasisAuto.test.ts +21 -0
  237. package/yoga/javascript/tests/YGHadOverflowTest.test.ts +110 -0
  238. package/yoga/javascript/tests/YGHasNewLayout.test.ts +81 -0
  239. package/yoga/javascript/tests/YGMeasureCacheTest.test.ts +29 -0
  240. package/yoga/javascript/tests/YGMeasureTest.test.ts +66 -0
  241. package/yoga/javascript/tests/bin/run-bench.ts +60 -0
  242. package/yoga/javascript/tests/generated/YGAbsolutePositionTest.test.ts +1531 -0
  243. package/yoga/javascript/tests/generated/YGAlignContentTest.test.ts +5181 -0
  244. package/yoga/javascript/tests/generated/YGAlignItemsTest.test.ts +2013 -0
  245. package/yoga/javascript/tests/generated/YGAlignSelfTest.test.ts +248 -0
  246. package/yoga/javascript/tests/generated/YGAndroidNewsFeed.test.ts +306 -0
  247. package/yoga/javascript/tests/generated/YGAspectRatioTest.test.ts +66 -0
  248. package/yoga/javascript/tests/generated/YGAutoTest.test.ts +303 -0
  249. package/yoga/javascript/tests/generated/YGBorderTest.test.ts +199 -0
  250. package/yoga/javascript/tests/generated/YGBoxSizingTest.test.ts +1978 -0
  251. package/yoga/javascript/tests/generated/YGDimensionTest.test.ts +111 -0
  252. package/yoga/javascript/tests/generated/YGDisplayContentsTest.test.ts +99 -0
  253. package/yoga/javascript/tests/generated/YGDisplayTest.test.ts +962 -0
  254. package/yoga/javascript/tests/generated/YGFlexBasisFitContentTest.test.ts +364 -0
  255. package/yoga/javascript/tests/generated/YGFlexDirectionTest.test.ts +3903 -0
  256. package/yoga/javascript/tests/generated/YGFlexTest.test.ts +587 -0
  257. package/yoga/javascript/tests/generated/YGFlexWrapTest.test.ts +1768 -0
  258. package/yoga/javascript/tests/generated/YGGapTest.test.ts +2857 -0
  259. package/yoga/javascript/tests/generated/YGIntrinsicSizeTest.test.ts +843 -0
  260. package/yoga/javascript/tests/generated/YGJustifyContentTest.test.ts +1750 -0
  261. package/yoga/javascript/tests/generated/YGMarginTest.test.ts +1657 -0
  262. package/yoga/javascript/tests/generated/YGMinMaxDimensionTest.test.ts +1111 -0
  263. package/yoga/javascript/tests/generated/YGPaddingTest.test.ts +276 -0
  264. package/yoga/javascript/tests/generated/YGPercentageTest.test.ts +1246 -0
  265. package/yoga/javascript/tests/generated/YGRoundingTest.test.ts +1044 -0
  266. package/yoga/javascript/tests/generated/YGSizeOverflowTest.test.ts +180 -0
  267. package/yoga/javascript/tests/generated/YGStaticPositionTest.test.ts +5741 -0
  268. package/yoga/javascript/tests/tools/MeasureCounter.ts +66 -0
  269. package/yoga/javascript/tests/tools/globals.ts +19 -0
  270. package/yoga/javascript/tests/tools/utils.ts +90 -0
  271. package/yoga/javascript/tsconfig.json +23 -0
  272. package/yoga/lib/jni/jni.h +13 -0
  273. package/yoga/lib/jni/real/jni.h +1141 -0
  274. package/yoga/lib/jsr-305/jsr305.jar +0 -0
  275. package/yoga/lib/nlohmann/json.hpp +24766 -0
  276. package/yoga/lib/soloader/soloader-0.5.1.aar +0 -0
  277. package/yoga/package.json +44 -0
  278. package/yoga/scripts/clang-format +52 -0
  279. package/yoga/scripts/clang-format.js +93 -0
  280. package/yoga/scripts/format-kotlin.js +88 -0
  281. package/yoga/scripts/format-python.js +150 -0
  282. package/yoga/scripts/format-utils.js +82 -0
  283. package/yoga/set-version.py +37 -0
  284. package/yoga/settings.gradle.kts +29 -0
  285. package/yoga/test/AssertFatalTest.cpp +70 -0
  286. package/yoga/tests/.clang-tidy +7 -0
  287. package/yoga/tests/CMakeLists.txt +35 -0
  288. package/yoga/tests/CacheTest.cpp +229 -0
  289. package/yoga/tests/EventPublisherTest.cpp +162 -0
  290. package/yoga/tests/EventsTest.cpp +362 -0
  291. package/yoga/tests/FlexGapTest.cpp +93 -0
  292. package/yoga/tests/FloatOptionalTest.cpp +214 -0
  293. package/yoga/tests/GridStyleTest.cpp +103 -0
  294. package/yoga/tests/OrdinalsTest.cpp +35 -0
  295. package/yoga/tests/SmallValueBufferTest.cpp +161 -0
  296. package/yoga/tests/StyleTest.cpp +48 -0
  297. package/yoga/tests/StyleValuePoolTest.cpp +146 -0
  298. package/yoga/tests/YGAlignBaselineTest.cpp +837 -0
  299. package/yoga/tests/YGAspectRatioTest.cpp +898 -0
  300. package/yoga/tests/YGAutoMinSizeTest.cpp +581 -0
  301. package/yoga/tests/YGBaselineFuncTest.cpp +62 -0
  302. package/yoga/tests/YGCloneNodeTest.cpp +131 -0
  303. package/yoga/tests/YGComputedMarginTest.cpp +117 -0
  304. package/yoga/tests/YGComputedPaddingTest.cpp +119 -0
  305. package/yoga/tests/YGConfigTest.cpp +239 -0
  306. package/yoga/tests/YGContentsNodeHasNewLayoutTest.cpp +190 -0
  307. package/yoga/tests/YGDefaultValuesTest.cpp +175 -0
  308. package/yoga/tests/YGDirtiedTest.cpp +110 -0
  309. package/yoga/tests/YGDirtyMarkingTest.cpp +341 -0
  310. package/yoga/tests/YGEdgeTest.cpp +161 -0
  311. package/yoga/tests/YGFirstChildMinWidthTest.cpp +133 -0
  312. package/yoga/tests/YGFlexBasisFitContentTest.cpp +241 -0
  313. package/yoga/tests/YGFlexShrinkBorderBugTest.cpp +48 -0
  314. package/yoga/tests/YGHadOverflowTest.cpp +135 -0
  315. package/yoga/tests/YGLayoutableChildrenTest.cpp +191 -0
  316. package/yoga/tests/YGMeasureCacheTest.cpp +178 -0
  317. package/yoga/tests/YGMeasureModeTest.cpp +332 -0
  318. package/yoga/tests/YGMeasureTest.cpp +1010 -0
  319. package/yoga/tests/YGNodeCallbackTest.cpp +80 -0
  320. package/yoga/tests/YGNodeChildTest.cpp +68 -0
  321. package/yoga/tests/YGPersistenceTest.cpp +291 -0
  322. package/yoga/tests/YGPersistentNodeCloningTest.cpp +214 -0
  323. package/yoga/tests/YGRelayoutTest.cpp +255 -0
  324. package/yoga/tests/YGRoundingFunctionTest.cpp +186 -0
  325. package/yoga/tests/YGRoundingMeasureFuncTest.cpp +139 -0
  326. package/yoga/tests/YGScaleChangeTest.cpp +176 -0
  327. package/yoga/tests/YGStyleTest.cpp +75 -0
  328. package/yoga/tests/YGTreeMutationTest.cpp +115 -0
  329. package/yoga/tests/YGValueTest.cpp +23 -0
  330. package/yoga/tests/YGZeroOutLayoutRecursivelyTest.cpp +37 -0
  331. package/yoga/tests/generated/YGAbsolutePositionTest.cpp +1685 -0
  332. package/yoga/tests/generated/YGAlignContentTest.cpp +5485 -0
  333. package/yoga/tests/generated/YGAlignItemsTest.cpp +2142 -0
  334. package/yoga/tests/generated/YGAlignSelfTest.cpp +257 -0
  335. package/yoga/tests/generated/YGAndroidNewsFeed.cpp +295 -0
  336. package/yoga/tests/generated/YGAspectRatioTest.cpp +55 -0
  337. package/yoga/tests/generated/YGAutoTest.cpp +312 -0
  338. package/yoga/tests/generated/YGBorderTest.cpp +208 -0
  339. package/yoga/tests/generated/YGBoxSizingTest.cpp +2192 -0
  340. package/yoga/tests/generated/YGDimensionTest.cpp +105 -0
  341. package/yoga/tests/generated/YGDisplayContentsTest.cpp +89 -0
  342. package/yoga/tests/generated/YGDisplayTest.cpp +1016 -0
  343. package/yoga/tests/generated/YGFlexBasisFitContentTest.cpp +378 -0
  344. package/yoga/tests/generated/YGFlexDirectionTest.cpp +4152 -0
  345. package/yoga/tests/generated/YGFlexTest.cpp +621 -0
  346. package/yoga/tests/generated/YGFlexWrapTest.cpp +1867 -0
  347. package/yoga/tests/generated/YGGapTest.cpp +3001 -0
  348. package/yoga/tests/generated/YGIntrinsicSizeTest.cpp +924 -0
  349. package/yoga/tests/generated/YGJustifyContentTest.cpp +1874 -0
  350. package/yoga/tests/generated/YGMarginTest.cpp +1811 -0
  351. package/yoga/tests/generated/YGMinMaxDimensionTest.cpp +1215 -0
  352. package/yoga/tests/generated/YGPaddingTest.cpp +295 -0
  353. package/yoga/tests/generated/YGPercentageTest.cpp +1350 -0
  354. package/yoga/tests/generated/YGRoundingTest.cpp +1093 -0
  355. package/yoga/tests/generated/YGSizeOverflowTest.cpp +179 -0
  356. package/yoga/tests/generated/YGStaticPositionTest.cpp +6035 -0
  357. package/yoga/tests/util/TestUtil.cpp +164 -0
  358. package/yoga/tests/util/TestUtil.h +43 -0
  359. package/yoga/unit_tests +25 -0
  360. package/yoga/unit_tests.bat +28 -0
  361. package/yoga/website/.eslintrc.cjs +26 -0
  362. package/yoga/website/README.md +41 -0
  363. package/yoga/website/babel.config.cjs +10 -0
  364. package/yoga/website/blog/2023-06-30-announcing-yoga-2.0.md +183 -0
  365. package/yoga/website/blog/2024-06-24-announcing-yoga-3.1.md +67 -0
  366. package/yoga/website/blog/2024-12-02-announcing-yoga-3.2.md +84 -0
  367. package/yoga/website/blog/authors.yml +10 -0
  368. package/yoga/website/blog/yoga-3-release/2024-03-14-announcing-yoga-3.0.md +586 -0
  369. package/yoga/website/blog/yoga-3-release/img/image1.png +0 -0
  370. package/yoga/website/blog/yoga-3-release/img/image10.png +0 -0
  371. package/yoga/website/blog/yoga-3-release/img/image11.png +0 -0
  372. package/yoga/website/blog/yoga-3-release/img/image12.png +0 -0
  373. package/yoga/website/blog/yoga-3-release/img/image13.png +0 -0
  374. package/yoga/website/blog/yoga-3-release/img/image14.png +0 -0
  375. package/yoga/website/blog/yoga-3-release/img/image15.png +0 -0
  376. package/yoga/website/blog/yoga-3-release/img/image16.png +0 -0
  377. package/yoga/website/blog/yoga-3-release/img/image17.png +0 -0
  378. package/yoga/website/blog/yoga-3-release/img/image2.png +0 -0
  379. package/yoga/website/blog/yoga-3-release/img/image3.png +0 -0
  380. package/yoga/website/blog/yoga-3-release/img/image4.png +0 -0
  381. package/yoga/website/blog/yoga-3-release/img/image5.png +0 -0
  382. package/yoga/website/blog/yoga-3-release/img/image6.png +0 -0
  383. package/yoga/website/blog/yoga-3-release/img/image7.png +0 -0
  384. package/yoga/website/blog/yoga-3-release/img/image8.png +0 -0
  385. package/yoga/website/blog/yoga-3-release/img/image9.png +0 -0
  386. package/yoga/website/docs/about-yoga.md +13 -0
  387. package/yoga/website/docs/advanced/_category_.json +4 -0
  388. package/yoga/website/docs/advanced/containing-block.md +89 -0
  389. package/yoga/website/docs/advanced/external-layout-systems.mdx +106 -0
  390. package/yoga/website/docs/advanced/incremental-layout.mdx +87 -0
  391. package/yoga/website/docs/getting-started/_category_.json +4 -0
  392. package/yoga/website/docs/getting-started/configuring-yoga.mdx +165 -0
  393. package/yoga/website/docs/getting-started/laying-out-a-tree.mdx +178 -0
  394. package/yoga/website/docs/img/config-contextual.svg +17 -0
  395. package/yoga/website/docs/img/config-per-node.svg +17 -0
  396. package/yoga/website/docs/img/config-uniform.svg +17 -0
  397. package/yoga/website/docs/img/invalidation-clean-tree.svg +17 -0
  398. package/yoga/website/docs/img/invalidation-dirtied-tree.svg +17 -0
  399. package/yoga/website/docs/img/invalidation-new-layout-tree.svg +17 -0
  400. package/yoga/website/docs/img/pixel-grid-after.png +0 -0
  401. package/yoga/website/docs/img/pixel-grid-before.png +0 -0
  402. package/yoga/website/docs/img/wireframe-example.svg +105 -0
  403. package/yoga/website/docs/styling/_category_.json +4 -0
  404. package/yoga/website/docs/styling/align-content.mdx +47 -0
  405. package/yoga/website/docs/styling/align-items-self.mdx +48 -0
  406. package/yoga/website/docs/styling/aspect-ratio.mdx +27 -0
  407. package/yoga/website/docs/styling/display.mdx +25 -0
  408. package/yoga/website/docs/styling/flex-basis-grow-shrink.mdx +65 -0
  409. package/yoga/website/docs/styling/flex-direction.mdx +37 -0
  410. package/yoga/website/docs/styling/flex-wrap.mdx +33 -0
  411. package/yoga/website/docs/styling/gap.mdx +49 -0
  412. package/yoga/website/docs/styling/index.md +48 -0
  413. package/yoga/website/docs/styling/insets.mdx +62 -0
  414. package/yoga/website/docs/styling/justify-content.mdx +43 -0
  415. package/yoga/website/docs/styling/layout-direction.mdx +34 -0
  416. package/yoga/website/docs/styling/margin-padding-border.mdx +41 -0
  417. package/yoga/website/docs/styling/min-max-width-height.mdx +52 -0
  418. package/yoga/website/docs/styling/position.mdx +37 -0
  419. package/yoga/website/docs/styling/width-height.mdx +37 -0
  420. package/yoga/website/docusaurus.config.js +113 -0
  421. package/yoga/website/package.json +43 -0
  422. package/yoga/website/sidebars.cjs +27 -0
  423. package/yoga/website/src/components/EditorToolbar.module.css +77 -0
  424. package/yoga/website/src/components/EditorToolbar.tsx +72 -0
  425. package/yoga/website/src/components/FlexStyle.ts +439 -0
  426. package/yoga/website/src/components/LayoutBox.module.css +68 -0
  427. package/yoga/website/src/components/LayoutBox.tsx +61 -0
  428. package/yoga/website/src/components/Playground.module.css +130 -0
  429. package/yoga/website/src/components/Playground.tsx +187 -0
  430. package/yoga/website/src/components/YogaViewer.tsx +128 -0
  431. package/yoga/website/src/css/custom.css +37 -0
  432. package/yoga/website/src/pages/index.module.css +34 -0
  433. package/yoga/website/src/pages/index.tsx +84 -0
  434. package/yoga/website/src/pages/markdown-page.md +7 -0
  435. package/yoga/website/src/pages/playground.module.css +11 -0
  436. package/yoga/website/src/pages/playground.tsx +56 -0
  437. package/yoga/website/static/.nojekyll +0 -0
  438. package/yoga/website/static/img/docusaurus.png +0 -0
  439. package/yoga/website/static/img/favicon.svg +17 -0
  440. package/yoga/website/static/img/link.svg +4 -0
  441. package/yoga/website/static/img/logo.svg +17 -0
  442. package/yoga/website/static/img/meta_oss.svg +1 -0
  443. package/yoga/website/static/img/opengraph.png +0 -0
  444. package/yoga/website/static/img/undraw_docusaurus_mountain.svg +171 -0
  445. package/yoga/website/static/img/undraw_docusaurus_react.svg +170 -0
  446. package/yoga/website/static/img/undraw_docusaurus_tree.svg +40 -0
  447. package/yoga/website/tsconfig.json +10 -0
  448. package/yoga/yarn.lock +11499 -0
  449. package/yoga/yoga/CMakeLists.txt +41 -0
  450. package/yoga/yoga/YGConfig.cpp +92 -0
  451. package/yoga/yoga/YGConfig.h +158 -0
  452. package/yoga/yoga/YGEnums.cpp +304 -0
  453. package/yoga/yoga/YGEnums.h +163 -0
  454. package/yoga/yoga/YGMacros.h +101 -0
  455. package/yoga/yoga/YGNode.cpp +407 -0
  456. package/yoga/yoga/YGNode.h +373 -0
  457. package/yoga/yoga/YGNodeLayout.cpp +100 -0
  458. package/yoga/yoga/YGNodeLayout.h +43 -0
  459. package/yoga/yoga/YGNodeStyle.cpp +774 -0
  460. package/yoga/yoga/YGNodeStyle.h +243 -0
  461. package/yoga/yoga/YGPixelGrid.cpp +22 -0
  462. package/yoga/yoga/YGPixelGrid.h +29 -0
  463. package/yoga/yoga/YGValue.cpp +20 -0
  464. package/yoga/yoga/YGValue.h +83 -0
  465. package/yoga/yoga/Yoga.h +21 -0
  466. package/yoga/yoga/algorithm/AbsoluteLayout.cpp +595 -0
  467. package/yoga/yoga/algorithm/AbsoluteLayout.h +41 -0
  468. package/yoga/yoga/algorithm/Align.h +83 -0
  469. package/yoga/yoga/algorithm/Baseline.cpp +78 -0
  470. package/yoga/yoga/algorithm/Baseline.h +21 -0
  471. package/yoga/yoga/algorithm/BoundAxis.h +79 -0
  472. package/yoga/yoga/algorithm/Cache.cpp +121 -0
  473. package/yoga/yoga/algorithm/Cache.h +30 -0
  474. package/yoga/yoga/algorithm/CalculateLayout.cpp +2968 -0
  475. package/yoga/yoga/algorithm/CalculateLayout.h +60 -0
  476. package/yoga/yoga/algorithm/FlexDirection.h +120 -0
  477. package/yoga/yoga/algorithm/FlexLine.cpp +124 -0
  478. package/yoga/yoga/algorithm/FlexLine.h +75 -0
  479. package/yoga/yoga/algorithm/PixelGrid.cpp +138 -0
  480. package/yoga/yoga/algorithm/PixelGrid.h +29 -0
  481. package/yoga/yoga/algorithm/SizingMode.h +73 -0
  482. package/yoga/yoga/algorithm/TrailingPosition.h +44 -0
  483. package/yoga/yoga/config/Config.cpp +135 -0
  484. package/yoga/yoga/config/Config.h +93 -0
  485. package/yoga/yoga/debug/AssertFatal.cpp +54 -0
  486. package/yoga/yoga/debug/AssertFatal.h +29 -0
  487. package/yoga/yoga/debug/Log.cpp +107 -0
  488. package/yoga/yoga/debug/Log.h +34 -0
  489. package/yoga/yoga/enums/Align.h +49 -0
  490. package/yoga/yoga/enums/BoxSizing.h +40 -0
  491. package/yoga/yoga/enums/Dimension.h +40 -0
  492. package/yoga/yoga/enums/Direction.h +41 -0
  493. package/yoga/yoga/enums/Display.h +42 -0
  494. package/yoga/yoga/enums/Edge.h +47 -0
  495. package/yoga/yoga/enums/Errata.h +43 -0
  496. package/yoga/yoga/enums/ExperimentalFeature.h +40 -0
  497. package/yoga/yoga/enums/FlexDirection.h +42 -0
  498. package/yoga/yoga/enums/GridTrackType.h +43 -0
  499. package/yoga/yoga/enums/Gutter.h +41 -0
  500. package/yoga/yoga/enums/Justify.h +48 -0
  501. package/yoga/yoga/enums/LogLevel.h +44 -0
  502. package/yoga/yoga/enums/MeasureMode.h +41 -0
  503. package/yoga/yoga/enums/NodeType.h +40 -0
  504. package/yoga/yoga/enums/Overflow.h +41 -0
  505. package/yoga/yoga/enums/PhysicalEdge.h +21 -0
  506. package/yoga/yoga/enums/PositionType.h +41 -0
  507. package/yoga/yoga/enums/Unit.h +45 -0
  508. package/yoga/yoga/enums/Wrap.h +41 -0
  509. package/yoga/yoga/enums/YogaEnums.h +84 -0
  510. package/yoga/yoga/event/event.cpp +89 -0
  511. package/yoga/yoga/event/event.h +131 -0
  512. package/yoga/yoga/module.modulemap +21 -0
  513. package/yoga/yoga/node/CachedMeasurement.h +53 -0
  514. package/yoga/yoga/node/LayoutResults.cpp +48 -0
  515. package/yoga/yoga/node/LayoutResults.h +136 -0
  516. package/yoga/yoga/node/LayoutableChildren.h +148 -0
  517. package/yoga/yoga/node/Node.cpp +509 -0
  518. package/yoga/yoga/node/Node.h +372 -0
  519. package/yoga/yoga/numeric/Comparison.h +81 -0
  520. package/yoga/yoga/numeric/FloatOptional.h +84 -0
  521. package/yoga/yoga/style/GridLine.h +53 -0
  522. package/yoga/yoga/style/GridStyle.h +80 -0
  523. package/yoga/yoga/style/GridTrack.h +63 -0
  524. package/yoga/yoga/style/SmallValueBuffer.h +133 -0
  525. package/yoga/yoga/style/Style.h +932 -0
  526. package/yoga/yoga/style/StyleLength.h +121 -0
  527. package/yoga/yoga/style/StyleSizeLength.h +152 -0
  528. package/yoga/yoga/style/StyleValueHandle.h +114 -0
  529. package/yoga/yoga/style/StyleValuePool.h +194 -0
@@ -0,0 +1,1863 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @generated SignedSource<<e74a0779e3b4e492c2aa81f15bb2e760>>
8
+ * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexWrapTest.html
9
+ */
10
+
11
+ package com.facebook.yoga;
12
+
13
+ import static org.junit.Assert.assertEquals;
14
+
15
+ import org.junit.Ignore;
16
+ import org.junit.Test;
17
+ import org.junit.runner.RunWith;
18
+ import org.junit.runners.Parameterized;
19
+ import com.facebook.yoga.utils.TestUtils;
20
+
21
+ @RunWith(Parameterized.class)
22
+ public class YGFlexWrapTest {
23
+ @Parameterized.Parameters(name = "{0}")
24
+ public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
25
+ return TestParametrization.nodeFactories();
26
+ }
27
+
28
+ @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
29
+
30
+ @Test
31
+ public void test_wrap_row() {
32
+ YogaConfig config = YogaConfigFactory.create();
33
+
34
+ final YogaNode root = createNode(config);
35
+ root.setPositionType(YogaPositionType.ABSOLUTE);
36
+ root.setWidth(100f);
37
+ root.setFlexDirection(YogaFlexDirection.ROW);
38
+ root.setWrap(YogaWrap.WRAP);
39
+
40
+ final YogaNode root_child0 = createNode(config);
41
+ root_child0.setHeight(30f);
42
+ root_child0.setWidth(30f);
43
+ root.addChildAt(root_child0, 0);
44
+
45
+ final YogaNode root_child1 = createNode(config);
46
+ root_child1.setHeight(30f);
47
+ root_child1.setWidth(30f);
48
+ root.addChildAt(root_child1, 1);
49
+
50
+ final YogaNode root_child2 = createNode(config);
51
+ root_child2.setHeight(30f);
52
+ root_child2.setWidth(30f);
53
+ root.addChildAt(root_child2, 2);
54
+
55
+ final YogaNode root_child3 = createNode(config);
56
+ root_child3.setHeight(30f);
57
+ root_child3.setWidth(30f);
58
+ root.addChildAt(root_child3, 3);
59
+ root.setDirection(YogaDirection.LTR);
60
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
61
+
62
+ assertEquals(0f, root.getLayoutX(), 0.0f);
63
+ assertEquals(0f, root.getLayoutY(), 0.0f);
64
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
65
+ assertEquals(60f, root.getLayoutHeight(), 0.0f);
66
+
67
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
68
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
69
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
70
+ assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
71
+
72
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
73
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
74
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
75
+ assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
76
+
77
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
78
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
79
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
80
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
81
+
82
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
83
+ assertEquals(30f, root_child3.getLayoutY(), 0.0f);
84
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
85
+ assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
86
+
87
+ root.setDirection(YogaDirection.RTL);
88
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
89
+
90
+ assertEquals(0f, root.getLayoutX(), 0.0f);
91
+ assertEquals(0f, root.getLayoutY(), 0.0f);
92
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
93
+ assertEquals(60f, root.getLayoutHeight(), 0.0f);
94
+
95
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
96
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
97
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
98
+ assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
99
+
100
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
101
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
102
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
103
+ assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
104
+
105
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
106
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
107
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
108
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
109
+
110
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
111
+ assertEquals(30f, root_child3.getLayoutY(), 0.0f);
112
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
113
+ assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
114
+ }
115
+
116
+ @Test
117
+ public void test_wrap_row_align_items_flex_end() {
118
+ YogaConfig config = YogaConfigFactory.create();
119
+
120
+ final YogaNode root = createNode(config);
121
+ root.setPositionType(YogaPositionType.ABSOLUTE);
122
+ root.setWidth(100f);
123
+ root.setFlexDirection(YogaFlexDirection.ROW);
124
+ root.setWrap(YogaWrap.WRAP);
125
+ root.setAlignItems(YogaAlign.FLEX_END);
126
+
127
+ final YogaNode root_child0 = createNode(config);
128
+ root_child0.setHeight(10f);
129
+ root_child0.setWidth(30f);
130
+ root.addChildAt(root_child0, 0);
131
+
132
+ final YogaNode root_child1 = createNode(config);
133
+ root_child1.setHeight(20f);
134
+ root_child1.setWidth(30f);
135
+ root.addChildAt(root_child1, 1);
136
+
137
+ final YogaNode root_child2 = createNode(config);
138
+ root_child2.setHeight(30f);
139
+ root_child2.setWidth(30f);
140
+ root.addChildAt(root_child2, 2);
141
+
142
+ final YogaNode root_child3 = createNode(config);
143
+ root_child3.setHeight(30f);
144
+ root_child3.setWidth(30f);
145
+ root.addChildAt(root_child3, 3);
146
+ root.setDirection(YogaDirection.LTR);
147
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
148
+
149
+ assertEquals(0f, root.getLayoutX(), 0.0f);
150
+ assertEquals(0f, root.getLayoutY(), 0.0f);
151
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
152
+ assertEquals(60f, root.getLayoutHeight(), 0.0f);
153
+
154
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
155
+ assertEquals(20f, root_child0.getLayoutY(), 0.0f);
156
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
157
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
158
+
159
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
160
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
161
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
162
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
163
+
164
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
165
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
166
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
167
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
168
+
169
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
170
+ assertEquals(30f, root_child3.getLayoutY(), 0.0f);
171
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
172
+ assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
173
+
174
+ root.setDirection(YogaDirection.RTL);
175
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
176
+
177
+ assertEquals(0f, root.getLayoutX(), 0.0f);
178
+ assertEquals(0f, root.getLayoutY(), 0.0f);
179
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
180
+ assertEquals(60f, root.getLayoutHeight(), 0.0f);
181
+
182
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
183
+ assertEquals(20f, root_child0.getLayoutY(), 0.0f);
184
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
185
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
186
+
187
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
188
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
189
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
190
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
191
+
192
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
193
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
194
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
195
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
196
+
197
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
198
+ assertEquals(30f, root_child3.getLayoutY(), 0.0f);
199
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
200
+ assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
201
+ }
202
+
203
+ @Test
204
+ public void test_wrap_row_align_items_center() {
205
+ YogaConfig config = YogaConfigFactory.create();
206
+
207
+ final YogaNode root = createNode(config);
208
+ root.setPositionType(YogaPositionType.ABSOLUTE);
209
+ root.setWidth(100f);
210
+ root.setFlexDirection(YogaFlexDirection.ROW);
211
+ root.setWrap(YogaWrap.WRAP);
212
+ root.setAlignItems(YogaAlign.CENTER);
213
+
214
+ final YogaNode root_child0 = createNode(config);
215
+ root_child0.setHeight(10f);
216
+ root_child0.setWidth(30f);
217
+ root.addChildAt(root_child0, 0);
218
+
219
+ final YogaNode root_child1 = createNode(config);
220
+ root_child1.setHeight(20f);
221
+ root_child1.setWidth(30f);
222
+ root.addChildAt(root_child1, 1);
223
+
224
+ final YogaNode root_child2 = createNode(config);
225
+ root_child2.setHeight(30f);
226
+ root_child2.setWidth(30f);
227
+ root.addChildAt(root_child2, 2);
228
+
229
+ final YogaNode root_child3 = createNode(config);
230
+ root_child3.setHeight(30f);
231
+ root_child3.setWidth(30f);
232
+ root.addChildAt(root_child3, 3);
233
+ root.setDirection(YogaDirection.LTR);
234
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
235
+
236
+ assertEquals(0f, root.getLayoutX(), 0.0f);
237
+ assertEquals(0f, root.getLayoutY(), 0.0f);
238
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
239
+ assertEquals(60f, root.getLayoutHeight(), 0.0f);
240
+
241
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
242
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
243
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
244
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
245
+
246
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
247
+ assertEquals(5f, root_child1.getLayoutY(), 0.0f);
248
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
249
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
250
+
251
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
252
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
253
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
254
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
255
+
256
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
257
+ assertEquals(30f, root_child3.getLayoutY(), 0.0f);
258
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
259
+ assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
260
+
261
+ root.setDirection(YogaDirection.RTL);
262
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
263
+
264
+ assertEquals(0f, root.getLayoutX(), 0.0f);
265
+ assertEquals(0f, root.getLayoutY(), 0.0f);
266
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
267
+ assertEquals(60f, root.getLayoutHeight(), 0.0f);
268
+
269
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
270
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
271
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
272
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
273
+
274
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
275
+ assertEquals(5f, root_child1.getLayoutY(), 0.0f);
276
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
277
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
278
+
279
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
280
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
281
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
282
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
283
+
284
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
285
+ assertEquals(30f, root_child3.getLayoutY(), 0.0f);
286
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
287
+ assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
288
+ }
289
+
290
+ @Test
291
+ public void test_flex_wrap_children_with_min_main_overriding_flex_basis() {
292
+ YogaConfig config = YogaConfigFactory.create();
293
+
294
+ final YogaNode root = createNode(config);
295
+ root.setPositionType(YogaPositionType.ABSOLUTE);
296
+ root.setWidth(100f);
297
+ root.setWrap(YogaWrap.WRAP);
298
+ root.setFlexDirection(YogaFlexDirection.ROW);
299
+
300
+ final YogaNode root_child0 = createNode(config);
301
+ root_child0.setFlexBasis(50f);
302
+ root_child0.setHeight(50f);
303
+ root_child0.setMinWidth(55f);
304
+ root.addChildAt(root_child0, 0);
305
+
306
+ final YogaNode root_child1 = createNode(config);
307
+ root_child1.setFlexBasis(50f);
308
+ root_child1.setHeight(50f);
309
+ root_child1.setMinWidth(55f);
310
+ root.addChildAt(root_child1, 1);
311
+ root.setDirection(YogaDirection.LTR);
312
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
313
+
314
+ assertEquals(0f, root.getLayoutX(), 0.0f);
315
+ assertEquals(0f, root.getLayoutY(), 0.0f);
316
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
317
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
318
+
319
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
320
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
321
+ assertEquals(55f, root_child0.getLayoutWidth(), 0.0f);
322
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
323
+
324
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
325
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
326
+ assertEquals(55f, root_child1.getLayoutWidth(), 0.0f);
327
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
328
+
329
+ root.setDirection(YogaDirection.RTL);
330
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
331
+
332
+ assertEquals(0f, root.getLayoutX(), 0.0f);
333
+ assertEquals(0f, root.getLayoutY(), 0.0f);
334
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
335
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
336
+
337
+ assertEquals(45f, root_child0.getLayoutX(), 0.0f);
338
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
339
+ assertEquals(55f, root_child0.getLayoutWidth(), 0.0f);
340
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
341
+
342
+ assertEquals(45f, root_child1.getLayoutX(), 0.0f);
343
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
344
+ assertEquals(55f, root_child1.getLayoutWidth(), 0.0f);
345
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
346
+ }
347
+
348
+ @Test
349
+ public void test_flex_wrap_wrap_to_child_height() {
350
+ YogaConfig config = YogaConfigFactory.create();
351
+
352
+ final YogaNode root = createNode(config);
353
+ root.setPositionType(YogaPositionType.ABSOLUTE);
354
+
355
+ final YogaNode root_child0 = createNode(config);
356
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
357
+ root_child0.setAlignItems(YogaAlign.FLEX_START);
358
+ root_child0.setWrap(YogaWrap.WRAP);
359
+ root.addChildAt(root_child0, 0);
360
+
361
+ final YogaNode root_child0_child0 = createNode(config);
362
+ root_child0_child0.setWidth(100f);
363
+ root_child0.addChildAt(root_child0_child0, 0);
364
+
365
+ final YogaNode root_child0_child0_child0 = createNode(config);
366
+ root_child0_child0_child0.setHeight(100f);
367
+ root_child0_child0_child0.setWidth(100f);
368
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
369
+
370
+ final YogaNode root_child1 = createNode(config);
371
+ root_child1.setWidth(100f);
372
+ root_child1.setHeight(100f);
373
+ root.addChildAt(root_child1, 1);
374
+ root.setDirection(YogaDirection.LTR);
375
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
376
+
377
+ assertEquals(0f, root.getLayoutX(), 0.0f);
378
+ assertEquals(0f, root.getLayoutY(), 0.0f);
379
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
380
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
381
+
382
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
383
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
384
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
385
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
386
+
387
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
388
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
389
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
390
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
391
+
392
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
393
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
394
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
395
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
396
+
397
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
398
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
399
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
400
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
401
+
402
+ root.setDirection(YogaDirection.RTL);
403
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
404
+
405
+ assertEquals(0f, root.getLayoutX(), 0.0f);
406
+ assertEquals(0f, root.getLayoutY(), 0.0f);
407
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
408
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
409
+
410
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
411
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
412
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
413
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
414
+
415
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
416
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
417
+ assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
418
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
419
+
420
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
421
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
422
+ assertEquals(100f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
423
+ assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
424
+
425
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
426
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
427
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
428
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
429
+ }
430
+
431
+ @Test
432
+ public void test_flex_wrap_align_stretch_fits_one_row() {
433
+ YogaConfig config = YogaConfigFactory.create();
434
+
435
+ final YogaNode root = createNode(config);
436
+ root.setPositionType(YogaPositionType.ABSOLUTE);
437
+ root.setWidth(150f);
438
+ root.setHeight(100f);
439
+ root.setWrap(YogaWrap.WRAP);
440
+ root.setFlexDirection(YogaFlexDirection.ROW);
441
+
442
+ final YogaNode root_child0 = createNode(config);
443
+ root_child0.setWidth(50f);
444
+ root.addChildAt(root_child0, 0);
445
+
446
+ final YogaNode root_child1 = createNode(config);
447
+ root_child1.setWidth(50f);
448
+ root.addChildAt(root_child1, 1);
449
+ root.setDirection(YogaDirection.LTR);
450
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
451
+
452
+ assertEquals(0f, root.getLayoutX(), 0.0f);
453
+ assertEquals(0f, root.getLayoutY(), 0.0f);
454
+ assertEquals(150f, root.getLayoutWidth(), 0.0f);
455
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
456
+
457
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
458
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
459
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
460
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
461
+
462
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
463
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
464
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
465
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
466
+
467
+ root.setDirection(YogaDirection.RTL);
468
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
469
+
470
+ assertEquals(0f, root.getLayoutX(), 0.0f);
471
+ assertEquals(0f, root.getLayoutY(), 0.0f);
472
+ assertEquals(150f, root.getLayoutWidth(), 0.0f);
473
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
474
+
475
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
476
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
477
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
478
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
479
+
480
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
481
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
482
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
483
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
484
+ }
485
+
486
+ @Test
487
+ public void test_wrap_reverse_row_align_content_flex_start() {
488
+ YogaConfig config = YogaConfigFactory.create();
489
+
490
+ final YogaNode root = createNode(config);
491
+ root.setPositionType(YogaPositionType.ABSOLUTE);
492
+ root.setWidth(100f);
493
+ root.setFlexDirection(YogaFlexDirection.ROW);
494
+ root.setWrap(YogaWrap.WRAP_REVERSE);
495
+
496
+ final YogaNode root_child0 = createNode(config);
497
+ root_child0.setHeight(10f);
498
+ root_child0.setWidth(30f);
499
+ root.addChildAt(root_child0, 0);
500
+
501
+ final YogaNode root_child1 = createNode(config);
502
+ root_child1.setHeight(20f);
503
+ root_child1.setWidth(30f);
504
+ root.addChildAt(root_child1, 1);
505
+
506
+ final YogaNode root_child2 = createNode(config);
507
+ root_child2.setHeight(30f);
508
+ root_child2.setWidth(30f);
509
+ root.addChildAt(root_child2, 2);
510
+
511
+ final YogaNode root_child3 = createNode(config);
512
+ root_child3.setHeight(40f);
513
+ root_child3.setWidth(30f);
514
+ root.addChildAt(root_child3, 3);
515
+
516
+ final YogaNode root_child4 = createNode(config);
517
+ root_child4.setHeight(50f);
518
+ root_child4.setWidth(30f);
519
+ root.addChildAt(root_child4, 4);
520
+ root.setDirection(YogaDirection.LTR);
521
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
522
+
523
+ assertEquals(0f, root.getLayoutX(), 0.0f);
524
+ assertEquals(0f, root.getLayoutY(), 0.0f);
525
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
526
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
527
+
528
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
529
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
530
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
531
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
532
+
533
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
534
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
535
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
536
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
537
+
538
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
539
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
540
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
541
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
542
+
543
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
544
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
545
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
546
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
547
+
548
+ assertEquals(30f, root_child4.getLayoutX(), 0.0f);
549
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
550
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
551
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
552
+
553
+ root.setDirection(YogaDirection.RTL);
554
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
555
+
556
+ assertEquals(0f, root.getLayoutX(), 0.0f);
557
+ assertEquals(0f, root.getLayoutY(), 0.0f);
558
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
559
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
560
+
561
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
562
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
563
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
564
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
565
+
566
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
567
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
568
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
569
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
570
+
571
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
572
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
573
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
574
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
575
+
576
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
577
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
578
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
579
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
580
+
581
+ assertEquals(40f, root_child4.getLayoutX(), 0.0f);
582
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
583
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
584
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
585
+ }
586
+
587
+ @Test
588
+ public void test_wrap_reverse_row_align_content_center() {
589
+ YogaConfig config = YogaConfigFactory.create();
590
+
591
+ final YogaNode root = createNode(config);
592
+ root.setPositionType(YogaPositionType.ABSOLUTE);
593
+ root.setWidth(100f);
594
+ root.setFlexDirection(YogaFlexDirection.ROW);
595
+ root.setWrap(YogaWrap.WRAP_REVERSE);
596
+ root.setAlignContent(YogaAlign.CENTER);
597
+
598
+ final YogaNode root_child0 = createNode(config);
599
+ root_child0.setHeight(10f);
600
+ root_child0.setWidth(30f);
601
+ root.addChildAt(root_child0, 0);
602
+
603
+ final YogaNode root_child1 = createNode(config);
604
+ root_child1.setHeight(20f);
605
+ root_child1.setWidth(30f);
606
+ root.addChildAt(root_child1, 1);
607
+
608
+ final YogaNode root_child2 = createNode(config);
609
+ root_child2.setHeight(30f);
610
+ root_child2.setWidth(30f);
611
+ root.addChildAt(root_child2, 2);
612
+
613
+ final YogaNode root_child3 = createNode(config);
614
+ root_child3.setHeight(40f);
615
+ root_child3.setWidth(30f);
616
+ root.addChildAt(root_child3, 3);
617
+
618
+ final YogaNode root_child4 = createNode(config);
619
+ root_child4.setHeight(50f);
620
+ root_child4.setWidth(30f);
621
+ root.addChildAt(root_child4, 4);
622
+ root.setDirection(YogaDirection.LTR);
623
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
624
+
625
+ assertEquals(0f, root.getLayoutX(), 0.0f);
626
+ assertEquals(0f, root.getLayoutY(), 0.0f);
627
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
628
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
629
+
630
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
631
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
632
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
633
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
634
+
635
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
636
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
637
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
638
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
639
+
640
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
641
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
642
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
643
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
644
+
645
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
646
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
647
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
648
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
649
+
650
+ assertEquals(30f, root_child4.getLayoutX(), 0.0f);
651
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
652
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
653
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
654
+
655
+ root.setDirection(YogaDirection.RTL);
656
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
657
+
658
+ assertEquals(0f, root.getLayoutX(), 0.0f);
659
+ assertEquals(0f, root.getLayoutY(), 0.0f);
660
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
661
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
662
+
663
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
664
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
665
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
666
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
667
+
668
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
669
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
670
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
671
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
672
+
673
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
674
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
675
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
676
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
677
+
678
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
679
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
680
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
681
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
682
+
683
+ assertEquals(40f, root_child4.getLayoutX(), 0.0f);
684
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
685
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
686
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
687
+ }
688
+
689
+ @Test
690
+ public void test_wrap_reverse_row_single_line_different_size() {
691
+ YogaConfig config = YogaConfigFactory.create();
692
+
693
+ final YogaNode root = createNode(config);
694
+ root.setPositionType(YogaPositionType.ABSOLUTE);
695
+ root.setWidth(300f);
696
+ root.setFlexDirection(YogaFlexDirection.ROW);
697
+ root.setWrap(YogaWrap.WRAP_REVERSE);
698
+
699
+ final YogaNode root_child0 = createNode(config);
700
+ root_child0.setHeight(10f);
701
+ root_child0.setWidth(30f);
702
+ root.addChildAt(root_child0, 0);
703
+
704
+ final YogaNode root_child1 = createNode(config);
705
+ root_child1.setHeight(20f);
706
+ root_child1.setWidth(30f);
707
+ root.addChildAt(root_child1, 1);
708
+
709
+ final YogaNode root_child2 = createNode(config);
710
+ root_child2.setHeight(30f);
711
+ root_child2.setWidth(30f);
712
+ root.addChildAt(root_child2, 2);
713
+
714
+ final YogaNode root_child3 = createNode(config);
715
+ root_child3.setHeight(40f);
716
+ root_child3.setWidth(30f);
717
+ root.addChildAt(root_child3, 3);
718
+
719
+ final YogaNode root_child4 = createNode(config);
720
+ root_child4.setHeight(50f);
721
+ root_child4.setWidth(30f);
722
+ root.addChildAt(root_child4, 4);
723
+ root.setDirection(YogaDirection.LTR);
724
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
725
+
726
+ assertEquals(0f, root.getLayoutX(), 0.0f);
727
+ assertEquals(0f, root.getLayoutY(), 0.0f);
728
+ assertEquals(300f, root.getLayoutWidth(), 0.0f);
729
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
730
+
731
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
732
+ assertEquals(40f, root_child0.getLayoutY(), 0.0f);
733
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
734
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
735
+
736
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
737
+ assertEquals(30f, root_child1.getLayoutY(), 0.0f);
738
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
739
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
740
+
741
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
742
+ assertEquals(20f, root_child2.getLayoutY(), 0.0f);
743
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
744
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
745
+
746
+ assertEquals(90f, root_child3.getLayoutX(), 0.0f);
747
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
748
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
749
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
750
+
751
+ assertEquals(120f, root_child4.getLayoutX(), 0.0f);
752
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
753
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
754
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
755
+
756
+ root.setDirection(YogaDirection.RTL);
757
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
758
+
759
+ assertEquals(0f, root.getLayoutX(), 0.0f);
760
+ assertEquals(0f, root.getLayoutY(), 0.0f);
761
+ assertEquals(300f, root.getLayoutWidth(), 0.0f);
762
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
763
+
764
+ assertEquals(270f, root_child0.getLayoutX(), 0.0f);
765
+ assertEquals(40f, root_child0.getLayoutY(), 0.0f);
766
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
767
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
768
+
769
+ assertEquals(240f, root_child1.getLayoutX(), 0.0f);
770
+ assertEquals(30f, root_child1.getLayoutY(), 0.0f);
771
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
772
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
773
+
774
+ assertEquals(210f, root_child2.getLayoutX(), 0.0f);
775
+ assertEquals(20f, root_child2.getLayoutY(), 0.0f);
776
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
777
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
778
+
779
+ assertEquals(180f, root_child3.getLayoutX(), 0.0f);
780
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
781
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
782
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
783
+
784
+ assertEquals(150f, root_child4.getLayoutX(), 0.0f);
785
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
786
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
787
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
788
+ }
789
+
790
+ @Test
791
+ public void test_wrap_reverse_row_align_content_stretch() {
792
+ YogaConfig config = YogaConfigFactory.create();
793
+
794
+ final YogaNode root = createNode(config);
795
+ root.setPositionType(YogaPositionType.ABSOLUTE);
796
+ root.setWidth(100f);
797
+ root.setFlexDirection(YogaFlexDirection.ROW);
798
+ root.setWrap(YogaWrap.WRAP_REVERSE);
799
+ root.setAlignContent(YogaAlign.STRETCH);
800
+
801
+ final YogaNode root_child0 = createNode(config);
802
+ root_child0.setHeight(10f);
803
+ root_child0.setWidth(30f);
804
+ root.addChildAt(root_child0, 0);
805
+
806
+ final YogaNode root_child1 = createNode(config);
807
+ root_child1.setHeight(20f);
808
+ root_child1.setWidth(30f);
809
+ root.addChildAt(root_child1, 1);
810
+
811
+ final YogaNode root_child2 = createNode(config);
812
+ root_child2.setHeight(30f);
813
+ root_child2.setWidth(30f);
814
+ root.addChildAt(root_child2, 2);
815
+
816
+ final YogaNode root_child3 = createNode(config);
817
+ root_child3.setHeight(40f);
818
+ root_child3.setWidth(30f);
819
+ root.addChildAt(root_child3, 3);
820
+
821
+ final YogaNode root_child4 = createNode(config);
822
+ root_child4.setHeight(50f);
823
+ root_child4.setWidth(30f);
824
+ root.addChildAt(root_child4, 4);
825
+ root.setDirection(YogaDirection.LTR);
826
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
827
+
828
+ assertEquals(0f, root.getLayoutX(), 0.0f);
829
+ assertEquals(0f, root.getLayoutY(), 0.0f);
830
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
831
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
832
+
833
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
834
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
835
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
836
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
837
+
838
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
839
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
840
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
841
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
842
+
843
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
844
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
845
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
846
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
847
+
848
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
849
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
850
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
851
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
852
+
853
+ assertEquals(30f, root_child4.getLayoutX(), 0.0f);
854
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
855
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
856
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
857
+
858
+ root.setDirection(YogaDirection.RTL);
859
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
860
+
861
+ assertEquals(0f, root.getLayoutX(), 0.0f);
862
+ assertEquals(0f, root.getLayoutY(), 0.0f);
863
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
864
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
865
+
866
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
867
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
868
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
869
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
870
+
871
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
872
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
873
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
874
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
875
+
876
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
877
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
878
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
879
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
880
+
881
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
882
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
883
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
884
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
885
+
886
+ assertEquals(40f, root_child4.getLayoutX(), 0.0f);
887
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
888
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
889
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
890
+ }
891
+
892
+ @Test
893
+ public void test_wrap_reverse_row_align_content_space_around() {
894
+ YogaConfig config = YogaConfigFactory.create();
895
+
896
+ final YogaNode root = createNode(config);
897
+ root.setPositionType(YogaPositionType.ABSOLUTE);
898
+ root.setWidth(100f);
899
+ root.setFlexDirection(YogaFlexDirection.ROW);
900
+ root.setWrap(YogaWrap.WRAP_REVERSE);
901
+ root.setAlignContent(YogaAlign.SPACE_AROUND);
902
+
903
+ final YogaNode root_child0 = createNode(config);
904
+ root_child0.setHeight(10f);
905
+ root_child0.setWidth(30f);
906
+ root.addChildAt(root_child0, 0);
907
+
908
+ final YogaNode root_child1 = createNode(config);
909
+ root_child1.setHeight(20f);
910
+ root_child1.setWidth(30f);
911
+ root.addChildAt(root_child1, 1);
912
+
913
+ final YogaNode root_child2 = createNode(config);
914
+ root_child2.setHeight(30f);
915
+ root_child2.setWidth(30f);
916
+ root.addChildAt(root_child2, 2);
917
+
918
+ final YogaNode root_child3 = createNode(config);
919
+ root_child3.setHeight(40f);
920
+ root_child3.setWidth(30f);
921
+ root.addChildAt(root_child3, 3);
922
+
923
+ final YogaNode root_child4 = createNode(config);
924
+ root_child4.setHeight(50f);
925
+ root_child4.setWidth(30f);
926
+ root.addChildAt(root_child4, 4);
927
+ root.setDirection(YogaDirection.LTR);
928
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
929
+
930
+ assertEquals(0f, root.getLayoutX(), 0.0f);
931
+ assertEquals(0f, root.getLayoutY(), 0.0f);
932
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
933
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
934
+
935
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
936
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
937
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
938
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
939
+
940
+ assertEquals(30f, root_child1.getLayoutX(), 0.0f);
941
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
942
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
943
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
944
+
945
+ assertEquals(60f, root_child2.getLayoutX(), 0.0f);
946
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
947
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
948
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
949
+
950
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
951
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
952
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
953
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
954
+
955
+ assertEquals(30f, root_child4.getLayoutX(), 0.0f);
956
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
957
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
958
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
959
+
960
+ root.setDirection(YogaDirection.RTL);
961
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
962
+
963
+ assertEquals(0f, root.getLayoutX(), 0.0f);
964
+ assertEquals(0f, root.getLayoutY(), 0.0f);
965
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
966
+ assertEquals(80f, root.getLayoutHeight(), 0.0f);
967
+
968
+ assertEquals(70f, root_child0.getLayoutX(), 0.0f);
969
+ assertEquals(70f, root_child0.getLayoutY(), 0.0f);
970
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
971
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
972
+
973
+ assertEquals(40f, root_child1.getLayoutX(), 0.0f);
974
+ assertEquals(60f, root_child1.getLayoutY(), 0.0f);
975
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
976
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
977
+
978
+ assertEquals(10f, root_child2.getLayoutX(), 0.0f);
979
+ assertEquals(50f, root_child2.getLayoutY(), 0.0f);
980
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
981
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
982
+
983
+ assertEquals(70f, root_child3.getLayoutX(), 0.0f);
984
+ assertEquals(10f, root_child3.getLayoutY(), 0.0f);
985
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
986
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
987
+
988
+ assertEquals(40f, root_child4.getLayoutX(), 0.0f);
989
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
990
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
991
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
992
+ }
993
+
994
+ @Test
995
+ public void test_wrap_reverse_column_fixed_size() {
996
+ YogaConfig config = YogaConfigFactory.create();
997
+
998
+ final YogaNode root = createNode(config);
999
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1000
+ root.setWidth(200f);
1001
+ root.setHeight(100f);
1002
+ root.setWrap(YogaWrap.WRAP_REVERSE);
1003
+ root.setAlignItems(YogaAlign.CENTER);
1004
+
1005
+ final YogaNode root_child0 = createNode(config);
1006
+ root_child0.setHeight(10f);
1007
+ root_child0.setWidth(30f);
1008
+ root.addChildAt(root_child0, 0);
1009
+
1010
+ final YogaNode root_child1 = createNode(config);
1011
+ root_child1.setHeight(20f);
1012
+ root_child1.setWidth(30f);
1013
+ root.addChildAt(root_child1, 1);
1014
+
1015
+ final YogaNode root_child2 = createNode(config);
1016
+ root_child2.setHeight(30f);
1017
+ root_child2.setWidth(30f);
1018
+ root.addChildAt(root_child2, 2);
1019
+
1020
+ final YogaNode root_child3 = createNode(config);
1021
+ root_child3.setHeight(40f);
1022
+ root_child3.setWidth(30f);
1023
+ root.addChildAt(root_child3, 3);
1024
+
1025
+ final YogaNode root_child4 = createNode(config);
1026
+ root_child4.setHeight(50f);
1027
+ root_child4.setWidth(30f);
1028
+ root.addChildAt(root_child4, 4);
1029
+ root.setDirection(YogaDirection.LTR);
1030
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1031
+
1032
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1033
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1034
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1035
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1036
+
1037
+ assertEquals(170f, root_child0.getLayoutX(), 0.0f);
1038
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1039
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
1040
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
1041
+
1042
+ assertEquals(170f, root_child1.getLayoutX(), 0.0f);
1043
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
1044
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
1045
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
1046
+
1047
+ assertEquals(170f, root_child2.getLayoutX(), 0.0f);
1048
+ assertEquals(30f, root_child2.getLayoutY(), 0.0f);
1049
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
1050
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
1051
+
1052
+ assertEquals(170f, root_child3.getLayoutX(), 0.0f);
1053
+ assertEquals(60f, root_child3.getLayoutY(), 0.0f);
1054
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
1055
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
1056
+
1057
+ assertEquals(140f, root_child4.getLayoutX(), 0.0f);
1058
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
1059
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
1060
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
1061
+
1062
+ root.setDirection(YogaDirection.RTL);
1063
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1064
+
1065
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1066
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1067
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1068
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1069
+
1070
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1071
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1072
+ assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
1073
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
1074
+
1075
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1076
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
1077
+ assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
1078
+ assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
1079
+
1080
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
1081
+ assertEquals(30f, root_child2.getLayoutY(), 0.0f);
1082
+ assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
1083
+ assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
1084
+
1085
+ assertEquals(0f, root_child3.getLayoutX(), 0.0f);
1086
+ assertEquals(60f, root_child3.getLayoutY(), 0.0f);
1087
+ assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
1088
+ assertEquals(40f, root_child3.getLayoutHeight(), 0.0f);
1089
+
1090
+ assertEquals(30f, root_child4.getLayoutX(), 0.0f);
1091
+ assertEquals(0f, root_child4.getLayoutY(), 0.0f);
1092
+ assertEquals(30f, root_child4.getLayoutWidth(), 0.0f);
1093
+ assertEquals(50f, root_child4.getLayoutHeight(), 0.0f);
1094
+ }
1095
+
1096
+ @Test
1097
+ public void test_wrapped_row_within_align_items_center() {
1098
+ YogaConfig config = YogaConfigFactory.create();
1099
+
1100
+ final YogaNode root = createNode(config);
1101
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1102
+ root.setWidth(200f);
1103
+ root.setHeight(200f);
1104
+ root.setAlignItems(YogaAlign.CENTER);
1105
+
1106
+ final YogaNode root_child0 = createNode(config);
1107
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
1108
+ root_child0.setWrap(YogaWrap.WRAP);
1109
+ root.addChildAt(root_child0, 0);
1110
+
1111
+ final YogaNode root_child0_child0 = createNode(config);
1112
+ root_child0_child0.setWidth(150f);
1113
+ root_child0_child0.setHeight(80f);
1114
+ root_child0.addChildAt(root_child0_child0, 0);
1115
+
1116
+ final YogaNode root_child0_child1 = createNode(config);
1117
+ root_child0_child1.setWidth(80f);
1118
+ root_child0_child1.setHeight(80f);
1119
+ root_child0.addChildAt(root_child0_child1, 1);
1120
+ root.setDirection(YogaDirection.LTR);
1121
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1122
+
1123
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1124
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1125
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1126
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
1127
+
1128
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1129
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1130
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
1131
+ assertEquals(160f, root_child0.getLayoutHeight(), 0.0f);
1132
+
1133
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1134
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1135
+ assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f);
1136
+ assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f);
1137
+
1138
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
1139
+ assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f);
1140
+ assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f);
1141
+ assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f);
1142
+
1143
+ root.setDirection(YogaDirection.RTL);
1144
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1145
+
1146
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1147
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1148
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1149
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
1150
+
1151
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1152
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1153
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
1154
+ assertEquals(160f, root_child0.getLayoutHeight(), 0.0f);
1155
+
1156
+ assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
1157
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1158
+ assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f);
1159
+ assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f);
1160
+
1161
+ assertEquals(120f, root_child0_child1.getLayoutX(), 0.0f);
1162
+ assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f);
1163
+ assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f);
1164
+ assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f);
1165
+ }
1166
+
1167
+ @Test
1168
+ public void test_wrapped_row_within_align_items_flex_start() {
1169
+ YogaConfig config = YogaConfigFactory.create();
1170
+
1171
+ final YogaNode root = createNode(config);
1172
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1173
+ root.setWidth(200f);
1174
+ root.setHeight(200f);
1175
+ root.setAlignItems(YogaAlign.FLEX_START);
1176
+
1177
+ final YogaNode root_child0 = createNode(config);
1178
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
1179
+ root_child0.setWrap(YogaWrap.WRAP);
1180
+ root.addChildAt(root_child0, 0);
1181
+
1182
+ final YogaNode root_child0_child0 = createNode(config);
1183
+ root_child0_child0.setWidth(150f);
1184
+ root_child0_child0.setHeight(80f);
1185
+ root_child0.addChildAt(root_child0_child0, 0);
1186
+
1187
+ final YogaNode root_child0_child1 = createNode(config);
1188
+ root_child0_child1.setWidth(80f);
1189
+ root_child0_child1.setHeight(80f);
1190
+ root_child0.addChildAt(root_child0_child1, 1);
1191
+ root.setDirection(YogaDirection.LTR);
1192
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1193
+
1194
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1195
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1196
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1197
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
1198
+
1199
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1200
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1201
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
1202
+ assertEquals(160f, root_child0.getLayoutHeight(), 0.0f);
1203
+
1204
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1205
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1206
+ assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f);
1207
+ assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f);
1208
+
1209
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
1210
+ assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f);
1211
+ assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f);
1212
+ assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f);
1213
+
1214
+ root.setDirection(YogaDirection.RTL);
1215
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1216
+
1217
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1218
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1219
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1220
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
1221
+
1222
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1223
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1224
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
1225
+ assertEquals(160f, root_child0.getLayoutHeight(), 0.0f);
1226
+
1227
+ assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
1228
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1229
+ assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f);
1230
+ assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f);
1231
+
1232
+ assertEquals(120f, root_child0_child1.getLayoutX(), 0.0f);
1233
+ assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f);
1234
+ assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f);
1235
+ assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f);
1236
+ }
1237
+
1238
+ @Test
1239
+ public void test_wrapped_row_within_align_items_flex_end() {
1240
+ YogaConfig config = YogaConfigFactory.create();
1241
+
1242
+ final YogaNode root = createNode(config);
1243
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1244
+ root.setWidth(200f);
1245
+ root.setHeight(200f);
1246
+ root.setAlignItems(YogaAlign.FLEX_END);
1247
+
1248
+ final YogaNode root_child0 = createNode(config);
1249
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
1250
+ root_child0.setWrap(YogaWrap.WRAP);
1251
+ root.addChildAt(root_child0, 0);
1252
+
1253
+ final YogaNode root_child0_child0 = createNode(config);
1254
+ root_child0_child0.setWidth(150f);
1255
+ root_child0_child0.setHeight(80f);
1256
+ root_child0.addChildAt(root_child0_child0, 0);
1257
+
1258
+ final YogaNode root_child0_child1 = createNode(config);
1259
+ root_child0_child1.setWidth(80f);
1260
+ root_child0_child1.setHeight(80f);
1261
+ root_child0.addChildAt(root_child0_child1, 1);
1262
+ root.setDirection(YogaDirection.LTR);
1263
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1264
+
1265
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1266
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1267
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1268
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
1269
+
1270
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1271
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1272
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
1273
+ assertEquals(160f, root_child0.getLayoutHeight(), 0.0f);
1274
+
1275
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1276
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1277
+ assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f);
1278
+ assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f);
1279
+
1280
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
1281
+ assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f);
1282
+ assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f);
1283
+ assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f);
1284
+
1285
+ root.setDirection(YogaDirection.RTL);
1286
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1287
+
1288
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1289
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1290
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
1291
+ assertEquals(200f, root.getLayoutHeight(), 0.0f);
1292
+
1293
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1294
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1295
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
1296
+ assertEquals(160f, root_child0.getLayoutHeight(), 0.0f);
1297
+
1298
+ assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
1299
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1300
+ assertEquals(150f, root_child0_child0.getLayoutWidth(), 0.0f);
1301
+ assertEquals(80f, root_child0_child0.getLayoutHeight(), 0.0f);
1302
+
1303
+ assertEquals(120f, root_child0_child1.getLayoutX(), 0.0f);
1304
+ assertEquals(80f, root_child0_child1.getLayoutY(), 0.0f);
1305
+ assertEquals(80f, root_child0_child1.getLayoutWidth(), 0.0f);
1306
+ assertEquals(80f, root_child0_child1.getLayoutHeight(), 0.0f);
1307
+ }
1308
+
1309
+ @Test
1310
+ public void test_wrapped_column_max_height() {
1311
+ YogaConfig config = YogaConfigFactory.create();
1312
+
1313
+ final YogaNode root = createNode(config);
1314
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1315
+ root.setHeight(500f);
1316
+ root.setWidth(700f);
1317
+ root.setAlignItems(YogaAlign.CENTER);
1318
+ root.setJustifyContent(YogaJustify.CENTER);
1319
+ root.setAlignContent(YogaAlign.CENTER);
1320
+ root.setWrap(YogaWrap.WRAP);
1321
+
1322
+ final YogaNode root_child0 = createNode(config);
1323
+ root_child0.setWidth(100f);
1324
+ root_child0.setHeight(500f);
1325
+ root_child0.setMaxHeight(200f);
1326
+ root.addChildAt(root_child0, 0);
1327
+
1328
+ final YogaNode root_child1 = createNode(config);
1329
+ root_child1.setWidth(200f);
1330
+ root_child1.setHeight(200f);
1331
+ root_child1.setMargin(YogaEdge.ALL, 20f);
1332
+ root.addChildAt(root_child1, 1);
1333
+
1334
+ final YogaNode root_child2 = createNode(config);
1335
+ root_child2.setWidth(100f);
1336
+ root_child2.setHeight(100f);
1337
+ root.addChildAt(root_child2, 2);
1338
+ root.setDirection(YogaDirection.LTR);
1339
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1340
+
1341
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1342
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1343
+ assertEquals(700f, root.getLayoutWidth(), 0.0f);
1344
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1345
+
1346
+ assertEquals(250f, root_child0.getLayoutX(), 0.0f);
1347
+ assertEquals(30f, root_child0.getLayoutY(), 0.0f);
1348
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1349
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
1350
+
1351
+ assertEquals(200f, root_child1.getLayoutX(), 0.0f);
1352
+ assertEquals(250f, root_child1.getLayoutY(), 0.0f);
1353
+ assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
1354
+ assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
1355
+
1356
+ assertEquals(420f, root_child2.getLayoutX(), 0.0f);
1357
+ assertEquals(200f, root_child2.getLayoutY(), 0.0f);
1358
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
1359
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1360
+
1361
+ root.setDirection(YogaDirection.RTL);
1362
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1363
+
1364
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1365
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1366
+ assertEquals(700f, root.getLayoutWidth(), 0.0f);
1367
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1368
+
1369
+ assertEquals(350f, root_child0.getLayoutX(), 0.0f);
1370
+ assertEquals(30f, root_child0.getLayoutY(), 0.0f);
1371
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1372
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
1373
+
1374
+ assertEquals(300f, root_child1.getLayoutX(), 0.0f);
1375
+ assertEquals(250f, root_child1.getLayoutY(), 0.0f);
1376
+ assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
1377
+ assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
1378
+
1379
+ assertEquals(180f, root_child2.getLayoutX(), 0.0f);
1380
+ assertEquals(200f, root_child2.getLayoutY(), 0.0f);
1381
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
1382
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1383
+ }
1384
+
1385
+ @Test
1386
+ public void test_wrapped_column_max_height_flex() {
1387
+ YogaConfig config = YogaConfigFactory.create();
1388
+
1389
+ final YogaNode root = createNode(config);
1390
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1391
+ root.setHeight(500f);
1392
+ root.setWidth(700f);
1393
+ root.setAlignItems(YogaAlign.CENTER);
1394
+ root.setJustifyContent(YogaJustify.CENTER);
1395
+ root.setAlignContent(YogaAlign.CENTER);
1396
+ root.setWrap(YogaWrap.WRAP);
1397
+
1398
+ final YogaNode root_child0 = createNode(config);
1399
+ root_child0.setWidth(100f);
1400
+ root_child0.setHeight(500f);
1401
+ root_child0.setMaxHeight(200f);
1402
+ root_child0.setFlexGrow(1f);
1403
+ root_child0.setFlexShrink(1f);
1404
+ root_child0.setFlexBasisPercent(0f);
1405
+ root.addChildAt(root_child0, 0);
1406
+
1407
+ final YogaNode root_child1 = createNode(config);
1408
+ root_child1.setWidth(200f);
1409
+ root_child1.setHeight(200f);
1410
+ root_child1.setMargin(YogaEdge.ALL, 20f);
1411
+ root_child1.setFlexGrow(1f);
1412
+ root_child1.setFlexShrink(1f);
1413
+ root_child1.setFlexBasisPercent(0f);
1414
+ root.addChildAt(root_child1, 1);
1415
+
1416
+ final YogaNode root_child2 = createNode(config);
1417
+ root_child2.setWidth(100f);
1418
+ root_child2.setHeight(100f);
1419
+ root.addChildAt(root_child2, 2);
1420
+ root.setDirection(YogaDirection.LTR);
1421
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1422
+
1423
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1424
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1425
+ assertEquals(700f, root.getLayoutWidth(), 0.0f);
1426
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1427
+
1428
+ assertEquals(300f, root_child0.getLayoutX(), 0.0f);
1429
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1430
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1431
+ assertEquals(180f, root_child0.getLayoutHeight(), 0.0f);
1432
+
1433
+ assertEquals(250f, root_child1.getLayoutX(), 0.0f);
1434
+ assertEquals(200f, root_child1.getLayoutY(), 0.0f);
1435
+ assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
1436
+ assertEquals(180f, root_child1.getLayoutHeight(), 0.0f);
1437
+
1438
+ assertEquals(300f, root_child2.getLayoutX(), 0.0f);
1439
+ assertEquals(400f, root_child2.getLayoutY(), 0.0f);
1440
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
1441
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1442
+
1443
+ root.setDirection(YogaDirection.RTL);
1444
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1445
+
1446
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1447
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1448
+ assertEquals(700f, root.getLayoutWidth(), 0.0f);
1449
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1450
+
1451
+ assertEquals(300f, root_child0.getLayoutX(), 0.0f);
1452
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1453
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1454
+ assertEquals(180f, root_child0.getLayoutHeight(), 0.0f);
1455
+
1456
+ assertEquals(250f, root_child1.getLayoutX(), 0.0f);
1457
+ assertEquals(200f, root_child1.getLayoutY(), 0.0f);
1458
+ assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
1459
+ assertEquals(180f, root_child1.getLayoutHeight(), 0.0f);
1460
+
1461
+ assertEquals(300f, root_child2.getLayoutX(), 0.0f);
1462
+ assertEquals(400f, root_child2.getLayoutY(), 0.0f);
1463
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
1464
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1465
+ }
1466
+
1467
+ @Test
1468
+ public void test_wrap_nodes_with_content_sizing_overflowing_margin() {
1469
+ YogaConfig config = YogaConfigFactory.create();
1470
+
1471
+ final YogaNode root = createNode(config);
1472
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1473
+ root.setWidth(500f);
1474
+ root.setHeight(500f);
1475
+
1476
+ final YogaNode root_child0 = createNode(config);
1477
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
1478
+ root_child0.setWrap(YogaWrap.WRAP);
1479
+ root_child0.setWidth(85f);
1480
+ root.addChildAt(root_child0, 0);
1481
+
1482
+ final YogaNode root_child0_child0 = createNode(config);
1483
+ root_child0.addChildAt(root_child0_child0, 0);
1484
+
1485
+ final YogaNode root_child0_child0_child0 = createNode(config);
1486
+ root_child0_child0_child0.setHeight(40f);
1487
+ root_child0_child0_child0.setWidth(40f);
1488
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
1489
+
1490
+ final YogaNode root_child0_child1 = createNode(config);
1491
+ root_child0_child1.setMargin(YogaEdge.RIGHT, 10f);
1492
+ root_child0.addChildAt(root_child0_child1, 1);
1493
+
1494
+ final YogaNode root_child0_child1_child0 = createNode(config);
1495
+ root_child0_child1_child0.setHeight(40f);
1496
+ root_child0_child1_child0.setWidth(40f);
1497
+ root_child0_child1.addChildAt(root_child0_child1_child0, 0);
1498
+ root.setDirection(YogaDirection.LTR);
1499
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1500
+
1501
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1502
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1503
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1504
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1505
+
1506
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1507
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1508
+ assertEquals(85f, root_child0.getLayoutWidth(), 0.0f);
1509
+ assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
1510
+
1511
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1512
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1513
+ assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f);
1514
+ assertEquals(40f, root_child0_child0.getLayoutHeight(), 0.0f);
1515
+
1516
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
1517
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
1518
+ assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
1519
+ assertEquals(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
1520
+
1521
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
1522
+ assertEquals(40f, root_child0_child1.getLayoutY(), 0.0f);
1523
+ assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f);
1524
+ assertEquals(40f, root_child0_child1.getLayoutHeight(), 0.0f);
1525
+
1526
+ assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
1527
+ assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
1528
+ assertEquals(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
1529
+ assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
1530
+
1531
+ root.setDirection(YogaDirection.RTL);
1532
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1533
+
1534
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1535
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1536
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1537
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1538
+
1539
+ assertEquals(415f, root_child0.getLayoutX(), 0.0f);
1540
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1541
+ assertEquals(85f, root_child0.getLayoutWidth(), 0.0f);
1542
+ assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
1543
+
1544
+ assertEquals(45f, root_child0_child0.getLayoutX(), 0.0f);
1545
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1546
+ assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f);
1547
+ assertEquals(40f, root_child0_child0.getLayoutHeight(), 0.0f);
1548
+
1549
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
1550
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
1551
+ assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
1552
+ assertEquals(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
1553
+
1554
+ assertEquals(35f, root_child0_child1.getLayoutX(), 0.0f);
1555
+ assertEquals(40f, root_child0_child1.getLayoutY(), 0.0f);
1556
+ assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f);
1557
+ assertEquals(40f, root_child0_child1.getLayoutHeight(), 0.0f);
1558
+
1559
+ assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
1560
+ assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
1561
+ assertEquals(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
1562
+ assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
1563
+ }
1564
+
1565
+ @Test
1566
+ public void test_wrap_nodes_with_content_sizing_margin_cross() {
1567
+ YogaConfig config = YogaConfigFactory.create();
1568
+
1569
+ final YogaNode root = createNode(config);
1570
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1571
+ root.setWidth(500f);
1572
+ root.setHeight(500f);
1573
+
1574
+ final YogaNode root_child0 = createNode(config);
1575
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
1576
+ root_child0.setWrap(YogaWrap.WRAP);
1577
+ root_child0.setWidth(70f);
1578
+ root.addChildAt(root_child0, 0);
1579
+
1580
+ final YogaNode root_child0_child0 = createNode(config);
1581
+ root_child0.addChildAt(root_child0_child0, 0);
1582
+
1583
+ final YogaNode root_child0_child0_child0 = createNode(config);
1584
+ root_child0_child0_child0.setHeight(40f);
1585
+ root_child0_child0_child0.setWidth(40f);
1586
+ root_child0_child0.addChildAt(root_child0_child0_child0, 0);
1587
+
1588
+ final YogaNode root_child0_child1 = createNode(config);
1589
+ root_child0_child1.setMargin(YogaEdge.TOP, 10f);
1590
+ root_child0.addChildAt(root_child0_child1, 1);
1591
+
1592
+ final YogaNode root_child0_child1_child0 = createNode(config);
1593
+ root_child0_child1_child0.setHeight(40f);
1594
+ root_child0_child1_child0.setWidth(40f);
1595
+ root_child0_child1.addChildAt(root_child0_child1_child0, 0);
1596
+ root.setDirection(YogaDirection.LTR);
1597
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1598
+
1599
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1600
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1601
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1602
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1603
+
1604
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1605
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1606
+ assertEquals(70f, root_child0.getLayoutWidth(), 0.0f);
1607
+ assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
1608
+
1609
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1610
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1611
+ assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f);
1612
+ assertEquals(40f, root_child0_child0.getLayoutHeight(), 0.0f);
1613
+
1614
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
1615
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
1616
+ assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
1617
+ assertEquals(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
1618
+
1619
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
1620
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
1621
+ assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f);
1622
+ assertEquals(40f, root_child0_child1.getLayoutHeight(), 0.0f);
1623
+
1624
+ assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
1625
+ assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
1626
+ assertEquals(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
1627
+ assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
1628
+
1629
+ root.setDirection(YogaDirection.RTL);
1630
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1631
+
1632
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1633
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1634
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1635
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1636
+
1637
+ assertEquals(430f, root_child0.getLayoutX(), 0.0f);
1638
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1639
+ assertEquals(70f, root_child0.getLayoutWidth(), 0.0f);
1640
+ assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
1641
+
1642
+ assertEquals(30f, root_child0_child0.getLayoutX(), 0.0f);
1643
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1644
+ assertEquals(40f, root_child0_child0.getLayoutWidth(), 0.0f);
1645
+ assertEquals(40f, root_child0_child0.getLayoutHeight(), 0.0f);
1646
+
1647
+ assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
1648
+ assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
1649
+ assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
1650
+ assertEquals(40f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
1651
+
1652
+ assertEquals(30f, root_child0_child1.getLayoutX(), 0.0f);
1653
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
1654
+ assertEquals(40f, root_child0_child1.getLayoutWidth(), 0.0f);
1655
+ assertEquals(40f, root_child0_child1.getLayoutHeight(), 0.0f);
1656
+
1657
+ assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
1658
+ assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
1659
+ assertEquals(40f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
1660
+ assertEquals(40f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
1661
+ }
1662
+
1663
+ @Test
1664
+ public void test_wrap_with_min_cross_axis() {
1665
+ YogaConfig config = YogaConfigFactory.create();
1666
+
1667
+ final YogaNode root = createNode(config);
1668
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1669
+ root.setWidth(500f);
1670
+ root.setMinHeight(500f);
1671
+ root.setFlexDirection(YogaFlexDirection.ROW);
1672
+ root.setWrap(YogaWrap.WRAP);
1673
+
1674
+ final YogaNode root_child0 = createNode(config);
1675
+ root_child0.setWidth(400f);
1676
+ root_child0.setHeight(200f);
1677
+ root.addChildAt(root_child0, 0);
1678
+
1679
+ final YogaNode root_child1 = createNode(config);
1680
+ root_child1.setWidth(400f);
1681
+ root_child1.setHeight(200f);
1682
+ root.addChildAt(root_child1, 1);
1683
+ root.setDirection(YogaDirection.LTR);
1684
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1685
+
1686
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1687
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1688
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1689
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1690
+
1691
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1692
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1693
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
1694
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
1695
+
1696
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1697
+ assertEquals(200f, root_child1.getLayoutY(), 0.0f);
1698
+ assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
1699
+ assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
1700
+
1701
+ root.setDirection(YogaDirection.RTL);
1702
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1703
+
1704
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1705
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1706
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1707
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
1708
+
1709
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1710
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1711
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
1712
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
1713
+
1714
+ assertEquals(100f, root_child1.getLayoutX(), 0.0f);
1715
+ assertEquals(200f, root_child1.getLayoutY(), 0.0f);
1716
+ assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
1717
+ assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
1718
+ }
1719
+
1720
+ @Test
1721
+ public void test_wrap_with_max_cross_axis() {
1722
+ YogaConfig config = YogaConfigFactory.create();
1723
+
1724
+ final YogaNode root = createNode(config);
1725
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1726
+ root.setWidth(500f);
1727
+ root.setMaxHeight(500f);
1728
+ root.setFlexDirection(YogaFlexDirection.ROW);
1729
+ root.setWrap(YogaWrap.WRAP);
1730
+
1731
+ final YogaNode root_child0 = createNode(config);
1732
+ root_child0.setWidth(400f);
1733
+ root_child0.setHeight(200f);
1734
+ root.addChildAt(root_child0, 0);
1735
+
1736
+ final YogaNode root_child1 = createNode(config);
1737
+ root_child1.setWidth(400f);
1738
+ root_child1.setHeight(200f);
1739
+ root.addChildAt(root_child1, 1);
1740
+ root.setDirection(YogaDirection.LTR);
1741
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1742
+
1743
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1744
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1745
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1746
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
1747
+
1748
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1749
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1750
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
1751
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
1752
+
1753
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1754
+ assertEquals(200f, root_child1.getLayoutY(), 0.0f);
1755
+ assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
1756
+ assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
1757
+
1758
+ root.setDirection(YogaDirection.RTL);
1759
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1760
+
1761
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1762
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1763
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
1764
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
1765
+
1766
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1767
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1768
+ assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
1769
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
1770
+
1771
+ assertEquals(100f, root_child1.getLayoutX(), 0.0f);
1772
+ assertEquals(200f, root_child1.getLayoutY(), 0.0f);
1773
+ assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
1774
+ assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
1775
+ }
1776
+
1777
+ @Test
1778
+ public void test_nowrap_expands_flexline_box_to_min_cross() {
1779
+ YogaConfig config = YogaConfigFactory.create();
1780
+
1781
+ final YogaNode root = createNode(config);
1782
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1783
+ root.setMinHeight(400f);
1784
+ root.setFlexDirection(YogaFlexDirection.ROW);
1785
+
1786
+ final YogaNode root_child0 = createNode(config);
1787
+ root_child0.setFlexGrow(1f);
1788
+ root_child0.setFlexShrink(1f);
1789
+ root_child0.setFlexBasisPercent(0f);
1790
+ root.addChildAt(root_child0, 0);
1791
+ root.setDirection(YogaDirection.LTR);
1792
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1793
+
1794
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1795
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1796
+ assertEquals(0f, root.getLayoutWidth(), 0.0f);
1797
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
1798
+
1799
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1800
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1801
+ assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
1802
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
1803
+
1804
+ root.setDirection(YogaDirection.RTL);
1805
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1806
+
1807
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1808
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1809
+ assertEquals(0f, root.getLayoutWidth(), 0.0f);
1810
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
1811
+
1812
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1813
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1814
+ assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
1815
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
1816
+ }
1817
+
1818
+ @Test
1819
+ public void test_wrap_does_not_impose_min_cross_onto_single_flexline() {
1820
+ YogaConfig config = YogaConfigFactory.create();
1821
+
1822
+ final YogaNode root = createNode(config);
1823
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1824
+ root.setMinHeight(400f);
1825
+ root.setFlexDirection(YogaFlexDirection.ROW);
1826
+ root.setWrap(YogaWrap.WRAP);
1827
+
1828
+ final YogaNode root_child0 = createNode(config);
1829
+ root_child0.setFlexGrow(1f);
1830
+ root_child0.setFlexShrink(1f);
1831
+ root_child0.setFlexBasisPercent(0f);
1832
+ root.addChildAt(root_child0, 0);
1833
+ root.setDirection(YogaDirection.LTR);
1834
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1835
+
1836
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1837
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1838
+ assertEquals(0f, root.getLayoutWidth(), 0.0f);
1839
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
1840
+
1841
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1842
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1843
+ assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
1844
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1845
+
1846
+ root.setDirection(YogaDirection.RTL);
1847
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1848
+
1849
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1850
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1851
+ assertEquals(0f, root.getLayoutWidth(), 0.0f);
1852
+ assertEquals(400f, root.getLayoutHeight(), 0.0f);
1853
+
1854
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1855
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1856
+ assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
1857
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1858
+ }
1859
+
1860
+ private YogaNode createNode(YogaConfig config) {
1861
+ return mNodeFactory.create(config);
1862
+ }
1863
+ }