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,4118 @@
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<<99d3d24aad2ad28e77c81f979f9930fe>>
8
+ * generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGFlexDirectionTest.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 YGFlexDirectionTest {
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_flex_direction_column_no_height() {
32
+ YogaConfig config = YogaConfigFactory.create();
33
+
34
+ final YogaNode root = createNode(config);
35
+ root.setPositionType(YogaPositionType.ABSOLUTE);
36
+ root.setWidth(100f);
37
+
38
+ final YogaNode root_child0 = createNode(config);
39
+ root_child0.setHeight(10f);
40
+ root.addChildAt(root_child0, 0);
41
+
42
+ final YogaNode root_child1 = createNode(config);
43
+ root_child1.setHeight(10f);
44
+ root.addChildAt(root_child1, 1);
45
+
46
+ final YogaNode root_child2 = createNode(config);
47
+ root_child2.setHeight(10f);
48
+ root.addChildAt(root_child2, 2);
49
+ root.setDirection(YogaDirection.LTR);
50
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
51
+
52
+ assertEquals(0f, root.getLayoutX(), 0.0f);
53
+ assertEquals(0f, root.getLayoutY(), 0.0f);
54
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
55
+ assertEquals(30f, root.getLayoutHeight(), 0.0f);
56
+
57
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
58
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
59
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
60
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
61
+
62
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
63
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
64
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
65
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
66
+
67
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
68
+ assertEquals(20f, root_child2.getLayoutY(), 0.0f);
69
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
70
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
71
+
72
+ root.setDirection(YogaDirection.RTL);
73
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
74
+
75
+ assertEquals(0f, root.getLayoutX(), 0.0f);
76
+ assertEquals(0f, root.getLayoutY(), 0.0f);
77
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
78
+ assertEquals(30f, root.getLayoutHeight(), 0.0f);
79
+
80
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
81
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
82
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
83
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
84
+
85
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
86
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
87
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
88
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
89
+
90
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
91
+ assertEquals(20f, root_child2.getLayoutY(), 0.0f);
92
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
93
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
94
+ }
95
+
96
+ @Test
97
+ public void test_flex_direction_row_no_width() {
98
+ YogaConfig config = YogaConfigFactory.create();
99
+
100
+ final YogaNode root = createNode(config);
101
+ root.setPositionType(YogaPositionType.ABSOLUTE);
102
+ root.setHeight(100f);
103
+ root.setFlexDirection(YogaFlexDirection.ROW);
104
+
105
+ final YogaNode root_child0 = createNode(config);
106
+ root_child0.setWidth(10f);
107
+ root.addChildAt(root_child0, 0);
108
+
109
+ final YogaNode root_child1 = createNode(config);
110
+ root_child1.setWidth(10f);
111
+ root.addChildAt(root_child1, 1);
112
+
113
+ final YogaNode root_child2 = createNode(config);
114
+ root_child2.setWidth(10f);
115
+ root.addChildAt(root_child2, 2);
116
+ root.setDirection(YogaDirection.LTR);
117
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
118
+
119
+ assertEquals(0f, root.getLayoutX(), 0.0f);
120
+ assertEquals(0f, root.getLayoutY(), 0.0f);
121
+ assertEquals(30f, root.getLayoutWidth(), 0.0f);
122
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
123
+
124
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
125
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
126
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
127
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
128
+
129
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
130
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
131
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
132
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
133
+
134
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
135
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
136
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
137
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
138
+
139
+ root.setDirection(YogaDirection.RTL);
140
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
141
+
142
+ assertEquals(0f, root.getLayoutX(), 0.0f);
143
+ assertEquals(0f, root.getLayoutY(), 0.0f);
144
+ assertEquals(30f, root.getLayoutWidth(), 0.0f);
145
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
146
+
147
+ assertEquals(20f, root_child0.getLayoutX(), 0.0f);
148
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
149
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
150
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
151
+
152
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
153
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
154
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
155
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
156
+
157
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
158
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
159
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
160
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
161
+ }
162
+
163
+ @Test
164
+ public void test_flex_direction_column() {
165
+ YogaConfig config = YogaConfigFactory.create();
166
+
167
+ final YogaNode root = createNode(config);
168
+ root.setPositionType(YogaPositionType.ABSOLUTE);
169
+ root.setHeight(100f);
170
+ root.setWidth(100f);
171
+
172
+ final YogaNode root_child0 = createNode(config);
173
+ root_child0.setHeight(10f);
174
+ root.addChildAt(root_child0, 0);
175
+
176
+ final YogaNode root_child1 = createNode(config);
177
+ root_child1.setHeight(10f);
178
+ root.addChildAt(root_child1, 1);
179
+
180
+ final YogaNode root_child2 = createNode(config);
181
+ root_child2.setHeight(10f);
182
+ root.addChildAt(root_child2, 2);
183
+ root.setDirection(YogaDirection.LTR);
184
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
185
+
186
+ assertEquals(0f, root.getLayoutX(), 0.0f);
187
+ assertEquals(0f, root.getLayoutY(), 0.0f);
188
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
189
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
190
+
191
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
192
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
193
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
194
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
195
+
196
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
197
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
198
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
199
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
200
+
201
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
202
+ assertEquals(20f, root_child2.getLayoutY(), 0.0f);
203
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
204
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
205
+
206
+ root.setDirection(YogaDirection.RTL);
207
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
208
+
209
+ assertEquals(0f, root.getLayoutX(), 0.0f);
210
+ assertEquals(0f, root.getLayoutY(), 0.0f);
211
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
212
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
213
+
214
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
215
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
216
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
217
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
218
+
219
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
220
+ assertEquals(10f, root_child1.getLayoutY(), 0.0f);
221
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
222
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
223
+
224
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
225
+ assertEquals(20f, root_child2.getLayoutY(), 0.0f);
226
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
227
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
228
+ }
229
+
230
+ @Test
231
+ public void test_flex_direction_row() {
232
+ YogaConfig config = YogaConfigFactory.create();
233
+
234
+ final YogaNode root = createNode(config);
235
+ root.setPositionType(YogaPositionType.ABSOLUTE);
236
+ root.setHeight(100f);
237
+ root.setWidth(100f);
238
+ root.setFlexDirection(YogaFlexDirection.ROW);
239
+
240
+ final YogaNode root_child0 = createNode(config);
241
+ root_child0.setWidth(10f);
242
+ root.addChildAt(root_child0, 0);
243
+
244
+ final YogaNode root_child1 = createNode(config);
245
+ root_child1.setWidth(10f);
246
+ root.addChildAt(root_child1, 1);
247
+
248
+ final YogaNode root_child2 = createNode(config);
249
+ root_child2.setWidth(10f);
250
+ root.addChildAt(root_child2, 2);
251
+ root.setDirection(YogaDirection.LTR);
252
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
253
+
254
+ assertEquals(0f, root.getLayoutX(), 0.0f);
255
+ assertEquals(0f, root.getLayoutY(), 0.0f);
256
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
257
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
258
+
259
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
260
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
261
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
262
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
263
+
264
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
265
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
266
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
267
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
268
+
269
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
270
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
271
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
272
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
273
+
274
+ root.setDirection(YogaDirection.RTL);
275
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
276
+
277
+ assertEquals(0f, root.getLayoutX(), 0.0f);
278
+ assertEquals(0f, root.getLayoutY(), 0.0f);
279
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
280
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
281
+
282
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
283
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
284
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
285
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
286
+
287
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
288
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
289
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
290
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
291
+
292
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
293
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
294
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
295
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
296
+ }
297
+
298
+ @Test
299
+ public void test_flex_direction_column_reverse() {
300
+ YogaConfig config = YogaConfigFactory.create();
301
+
302
+ final YogaNode root = createNode(config);
303
+ root.setPositionType(YogaPositionType.ABSOLUTE);
304
+ root.setHeight(100f);
305
+ root.setWidth(100f);
306
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
307
+
308
+ final YogaNode root_child0 = createNode(config);
309
+ root_child0.setHeight(10f);
310
+ root.addChildAt(root_child0, 0);
311
+
312
+ final YogaNode root_child1 = createNode(config);
313
+ root_child1.setHeight(10f);
314
+ root.addChildAt(root_child1, 1);
315
+
316
+ final YogaNode root_child2 = createNode(config);
317
+ root_child2.setHeight(10f);
318
+ root.addChildAt(root_child2, 2);
319
+ root.setDirection(YogaDirection.LTR);
320
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
321
+
322
+ assertEquals(0f, root.getLayoutX(), 0.0f);
323
+ assertEquals(0f, root.getLayoutY(), 0.0f);
324
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
325
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
326
+
327
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
328
+ assertEquals(90f, root_child0.getLayoutY(), 0.0f);
329
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
330
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
331
+
332
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
333
+ assertEquals(80f, root_child1.getLayoutY(), 0.0f);
334
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
335
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
336
+
337
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
338
+ assertEquals(70f, root_child2.getLayoutY(), 0.0f);
339
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
340
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
341
+
342
+ root.setDirection(YogaDirection.RTL);
343
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
344
+
345
+ assertEquals(0f, root.getLayoutX(), 0.0f);
346
+ assertEquals(0f, root.getLayoutY(), 0.0f);
347
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
348
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
349
+
350
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
351
+ assertEquals(90f, root_child0.getLayoutY(), 0.0f);
352
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
353
+ assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
354
+
355
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
356
+ assertEquals(80f, root_child1.getLayoutY(), 0.0f);
357
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
358
+ assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
359
+
360
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
361
+ assertEquals(70f, root_child2.getLayoutY(), 0.0f);
362
+ assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
363
+ assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
364
+ }
365
+
366
+ @Test
367
+ public void test_flex_direction_row_reverse() {
368
+ YogaConfig config = YogaConfigFactory.create();
369
+
370
+ final YogaNode root = createNode(config);
371
+ root.setPositionType(YogaPositionType.ABSOLUTE);
372
+ root.setHeight(100f);
373
+ root.setWidth(100f);
374
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
375
+
376
+ final YogaNode root_child0 = createNode(config);
377
+ root_child0.setWidth(10f);
378
+ root.addChildAt(root_child0, 0);
379
+
380
+ final YogaNode root_child1 = createNode(config);
381
+ root_child1.setWidth(10f);
382
+ root.addChildAt(root_child1, 1);
383
+
384
+ final YogaNode root_child2 = createNode(config);
385
+ root_child2.setWidth(10f);
386
+ root.addChildAt(root_child2, 2);
387
+ root.setDirection(YogaDirection.LTR);
388
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
389
+
390
+ assertEquals(0f, root.getLayoutX(), 0.0f);
391
+ assertEquals(0f, root.getLayoutY(), 0.0f);
392
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
393
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
394
+
395
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
396
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
397
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
398
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
399
+
400
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
401
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
402
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
403
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
404
+
405
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
406
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
407
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
408
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
409
+
410
+ root.setDirection(YogaDirection.RTL);
411
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
412
+
413
+ assertEquals(0f, root.getLayoutX(), 0.0f);
414
+ assertEquals(0f, root.getLayoutY(), 0.0f);
415
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
416
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
417
+
418
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
419
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
420
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
421
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
422
+
423
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
424
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
425
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
426
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
427
+
428
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
429
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
430
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
431
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
432
+ }
433
+
434
+ @Test
435
+ public void test_flex_direction_row_reverse_margin_left() {
436
+ YogaConfig config = YogaConfigFactory.create();
437
+
438
+ final YogaNode root = createNode(config);
439
+ root.setPositionType(YogaPositionType.ABSOLUTE);
440
+ root.setHeight(100f);
441
+ root.setWidth(100f);
442
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
443
+ root.setMargin(YogaEdge.LEFT, 100f);
444
+
445
+ final YogaNode root_child0 = createNode(config);
446
+ root_child0.setWidth(10f);
447
+ root.addChildAt(root_child0, 0);
448
+
449
+ final YogaNode root_child1 = createNode(config);
450
+ root_child1.setWidth(10f);
451
+ root.addChildAt(root_child1, 1);
452
+
453
+ final YogaNode root_child2 = createNode(config);
454
+ root_child2.setWidth(10f);
455
+ root.addChildAt(root_child2, 2);
456
+ root.setDirection(YogaDirection.LTR);
457
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
458
+
459
+ assertEquals(100f, root.getLayoutX(), 0.0f);
460
+ assertEquals(0f, root.getLayoutY(), 0.0f);
461
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
462
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
463
+
464
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
465
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
466
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
467
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
468
+
469
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
470
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
471
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
472
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
473
+
474
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
475
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
476
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
477
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
478
+
479
+ root.setDirection(YogaDirection.RTL);
480
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
481
+
482
+ assertEquals(100f, root.getLayoutX(), 0.0f);
483
+ assertEquals(0f, root.getLayoutY(), 0.0f);
484
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
485
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
486
+
487
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
488
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
489
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
490
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
491
+
492
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
493
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
494
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
495
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
496
+
497
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
498
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
499
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
500
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
501
+ }
502
+
503
+ @Test
504
+ public void test_flex_direction_row_reverse_margin_start() {
505
+ YogaConfig config = YogaConfigFactory.create();
506
+
507
+ final YogaNode root = createNode(config);
508
+ root.setPositionType(YogaPositionType.ABSOLUTE);
509
+ root.setHeight(100f);
510
+ root.setWidth(100f);
511
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
512
+ root.setMargin(YogaEdge.START, 100f);
513
+
514
+ final YogaNode root_child0 = createNode(config);
515
+ root_child0.setWidth(10f);
516
+ root.addChildAt(root_child0, 0);
517
+
518
+ final YogaNode root_child1 = createNode(config);
519
+ root_child1.setWidth(10f);
520
+ root.addChildAt(root_child1, 1);
521
+
522
+ final YogaNode root_child2 = createNode(config);
523
+ root_child2.setWidth(10f);
524
+ root.addChildAt(root_child2, 2);
525
+ root.setDirection(YogaDirection.LTR);
526
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
527
+
528
+ assertEquals(100f, root.getLayoutX(), 0.0f);
529
+ assertEquals(0f, root.getLayoutY(), 0.0f);
530
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
531
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
532
+
533
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
534
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
535
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
536
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
537
+
538
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
539
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
540
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
541
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
542
+
543
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
544
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
545
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
546
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
547
+
548
+ root.setDirection(YogaDirection.RTL);
549
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
550
+
551
+ assertEquals(0f, root.getLayoutX(), 0.0f);
552
+ assertEquals(0f, root.getLayoutY(), 0.0f);
553
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
554
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
555
+
556
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
557
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
558
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
559
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
560
+
561
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
562
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
563
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
564
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
565
+
566
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
567
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
568
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
569
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
570
+ }
571
+
572
+ @Test
573
+ public void test_flex_direction_row_reverse_margin_right() {
574
+ YogaConfig config = YogaConfigFactory.create();
575
+
576
+ final YogaNode root = createNode(config);
577
+ root.setPositionType(YogaPositionType.ABSOLUTE);
578
+ root.setHeight(100f);
579
+ root.setWidth(100f);
580
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
581
+ root.setMargin(YogaEdge.RIGHT, 100f);
582
+
583
+ final YogaNode root_child0 = createNode(config);
584
+ root_child0.setWidth(10f);
585
+ root.addChildAt(root_child0, 0);
586
+
587
+ final YogaNode root_child1 = createNode(config);
588
+ root_child1.setWidth(10f);
589
+ root.addChildAt(root_child1, 1);
590
+
591
+ final YogaNode root_child2 = createNode(config);
592
+ root_child2.setWidth(10f);
593
+ root.addChildAt(root_child2, 2);
594
+ root.setDirection(YogaDirection.LTR);
595
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
596
+
597
+ assertEquals(0f, root.getLayoutX(), 0.0f);
598
+ assertEquals(0f, root.getLayoutY(), 0.0f);
599
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
600
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
601
+
602
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
603
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
604
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
605
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
606
+
607
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
608
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
609
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
610
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
611
+
612
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
613
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
614
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
615
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
616
+
617
+ root.setDirection(YogaDirection.RTL);
618
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
619
+
620
+ assertEquals(0f, root.getLayoutX(), 0.0f);
621
+ assertEquals(0f, root.getLayoutY(), 0.0f);
622
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
623
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
624
+
625
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
626
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
627
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
628
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
629
+
630
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
631
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
632
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
633
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
634
+
635
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
636
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
637
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
638
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
639
+ }
640
+
641
+ @Test
642
+ public void test_flex_direction_row_reverse_margin_end() {
643
+ YogaConfig config = YogaConfigFactory.create();
644
+
645
+ final YogaNode root = createNode(config);
646
+ root.setPositionType(YogaPositionType.ABSOLUTE);
647
+ root.setHeight(100f);
648
+ root.setWidth(100f);
649
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
650
+ root.setMargin(YogaEdge.END, 100f);
651
+
652
+ final YogaNode root_child0 = createNode(config);
653
+ root_child0.setWidth(10f);
654
+ root.addChildAt(root_child0, 0);
655
+
656
+ final YogaNode root_child1 = createNode(config);
657
+ root_child1.setWidth(10f);
658
+ root.addChildAt(root_child1, 1);
659
+
660
+ final YogaNode root_child2 = createNode(config);
661
+ root_child2.setWidth(10f);
662
+ root.addChildAt(root_child2, 2);
663
+ root.setDirection(YogaDirection.LTR);
664
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
665
+
666
+ assertEquals(0f, root.getLayoutX(), 0.0f);
667
+ assertEquals(0f, root.getLayoutY(), 0.0f);
668
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
669
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
670
+
671
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
672
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
673
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
674
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
675
+
676
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
677
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
678
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
679
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
680
+
681
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
682
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
683
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
684
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
685
+
686
+ root.setDirection(YogaDirection.RTL);
687
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
688
+
689
+ assertEquals(100f, root.getLayoutX(), 0.0f);
690
+ assertEquals(0f, root.getLayoutY(), 0.0f);
691
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
692
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
693
+
694
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
695
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
696
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
697
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
698
+
699
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
700
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
701
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
702
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
703
+
704
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
705
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
706
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
707
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
708
+ }
709
+
710
+ @Test
711
+ public void test_flex_direction_column_reverse_margin_top() {
712
+ YogaConfig config = YogaConfigFactory.create();
713
+
714
+ final YogaNode root = createNode(config);
715
+ root.setPositionType(YogaPositionType.ABSOLUTE);
716
+ root.setHeight(100f);
717
+ root.setWidth(100f);
718
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
719
+ root.setMargin(YogaEdge.TOP, 100f);
720
+
721
+ final YogaNode root_child0 = createNode(config);
722
+ root_child0.setWidth(10f);
723
+ root.addChildAt(root_child0, 0);
724
+
725
+ final YogaNode root_child1 = createNode(config);
726
+ root_child1.setWidth(10f);
727
+ root.addChildAt(root_child1, 1);
728
+
729
+ final YogaNode root_child2 = createNode(config);
730
+ root_child2.setWidth(10f);
731
+ root.addChildAt(root_child2, 2);
732
+ root.setDirection(YogaDirection.LTR);
733
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
734
+
735
+ assertEquals(0f, root.getLayoutX(), 0.0f);
736
+ assertEquals(100f, root.getLayoutY(), 0.0f);
737
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
738
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
739
+
740
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
741
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
742
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
743
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
744
+
745
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
746
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
747
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
748
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
749
+
750
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
751
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
752
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
753
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
754
+
755
+ root.setDirection(YogaDirection.RTL);
756
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
757
+
758
+ assertEquals(0f, root.getLayoutX(), 0.0f);
759
+ assertEquals(100f, root.getLayoutY(), 0.0f);
760
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
761
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
762
+
763
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
764
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
765
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
766
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
767
+
768
+ assertEquals(90f, root_child1.getLayoutX(), 0.0f);
769
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
770
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
771
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
772
+
773
+ assertEquals(90f, root_child2.getLayoutX(), 0.0f);
774
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
775
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
776
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
777
+ }
778
+
779
+ @Test
780
+ public void test_flex_direction_column_reverse_margin_bottom() {
781
+ YogaConfig config = YogaConfigFactory.create();
782
+
783
+ final YogaNode root = createNode(config);
784
+ root.setPositionType(YogaPositionType.ABSOLUTE);
785
+ root.setHeight(100f);
786
+ root.setWidth(100f);
787
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
788
+ root.setMargin(YogaEdge.BOTTOM, 100f);
789
+
790
+ final YogaNode root_child0 = createNode(config);
791
+ root_child0.setWidth(10f);
792
+ root.addChildAt(root_child0, 0);
793
+
794
+ final YogaNode root_child1 = createNode(config);
795
+ root_child1.setWidth(10f);
796
+ root.addChildAt(root_child1, 1);
797
+
798
+ final YogaNode root_child2 = createNode(config);
799
+ root_child2.setWidth(10f);
800
+ root.addChildAt(root_child2, 2);
801
+ root.setDirection(YogaDirection.LTR);
802
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
803
+
804
+ assertEquals(0f, root.getLayoutX(), 0.0f);
805
+ assertEquals(0f, root.getLayoutY(), 0.0f);
806
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
807
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
808
+
809
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
810
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
811
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
812
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
813
+
814
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
815
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
816
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
817
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
818
+
819
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
820
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
821
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
822
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
823
+
824
+ root.setDirection(YogaDirection.RTL);
825
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
826
+
827
+ assertEquals(0f, root.getLayoutX(), 0.0f);
828
+ assertEquals(0f, root.getLayoutY(), 0.0f);
829
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
830
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
831
+
832
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
833
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
834
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
835
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
836
+
837
+ assertEquals(90f, root_child1.getLayoutX(), 0.0f);
838
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
839
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
840
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
841
+
842
+ assertEquals(90f, root_child2.getLayoutX(), 0.0f);
843
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
844
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
845
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
846
+ }
847
+
848
+ @Test
849
+ public void test_flex_direction_row_reverse_padding_left() {
850
+ YogaConfig config = YogaConfigFactory.create();
851
+
852
+ final YogaNode root = createNode(config);
853
+ root.setPositionType(YogaPositionType.ABSOLUTE);
854
+ root.setHeight(100f);
855
+ root.setWidth(100f);
856
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
857
+ root.setPadding(YogaEdge.LEFT, 100);
858
+
859
+ final YogaNode root_child0 = createNode(config);
860
+ root_child0.setWidth(10f);
861
+ root.addChildAt(root_child0, 0);
862
+
863
+ final YogaNode root_child1 = createNode(config);
864
+ root_child1.setWidth(10f);
865
+ root.addChildAt(root_child1, 1);
866
+
867
+ final YogaNode root_child2 = createNode(config);
868
+ root_child2.setWidth(10f);
869
+ root.addChildAt(root_child2, 2);
870
+ root.setDirection(YogaDirection.LTR);
871
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
872
+
873
+ assertEquals(0f, root.getLayoutX(), 0.0f);
874
+ assertEquals(0f, root.getLayoutY(), 0.0f);
875
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
876
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
877
+
878
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
879
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
880
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
881
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
882
+
883
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
884
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
885
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
886
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
887
+
888
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
889
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
890
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
891
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
892
+
893
+ root.setDirection(YogaDirection.RTL);
894
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
895
+
896
+ assertEquals(0f, root.getLayoutX(), 0.0f);
897
+ assertEquals(0f, root.getLayoutY(), 0.0f);
898
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
899
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
900
+
901
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
902
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
903
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
904
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
905
+
906
+ assertEquals(110f, root_child1.getLayoutX(), 0.0f);
907
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
908
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
909
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
910
+
911
+ assertEquals(120f, root_child2.getLayoutX(), 0.0f);
912
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
913
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
914
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
915
+ }
916
+
917
+ @Test
918
+ public void test_flex_direction_row_reverse_padding_start() {
919
+ YogaConfig config = YogaConfigFactory.create();
920
+
921
+ final YogaNode root = createNode(config);
922
+ root.setPositionType(YogaPositionType.ABSOLUTE);
923
+ root.setHeight(100f);
924
+ root.setWidth(100f);
925
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
926
+ root.setPadding(YogaEdge.START, 100);
927
+
928
+ final YogaNode root_child0 = createNode(config);
929
+ root_child0.setWidth(10f);
930
+ root.addChildAt(root_child0, 0);
931
+
932
+ final YogaNode root_child1 = createNode(config);
933
+ root_child1.setWidth(10f);
934
+ root.addChildAt(root_child1, 1);
935
+
936
+ final YogaNode root_child2 = createNode(config);
937
+ root_child2.setWidth(10f);
938
+ root.addChildAt(root_child2, 2);
939
+ root.setDirection(YogaDirection.LTR);
940
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
941
+
942
+ assertEquals(0f, root.getLayoutX(), 0.0f);
943
+ assertEquals(0f, root.getLayoutY(), 0.0f);
944
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
945
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
946
+
947
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
948
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
949
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
950
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
951
+
952
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
953
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
954
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
955
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
956
+
957
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
958
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
959
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
960
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
961
+
962
+ root.setDirection(YogaDirection.RTL);
963
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
964
+
965
+ assertEquals(0f, root.getLayoutX(), 0.0f);
966
+ assertEquals(0f, root.getLayoutY(), 0.0f);
967
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
968
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
969
+
970
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
971
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
972
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
973
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
974
+
975
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
976
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
977
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
978
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
979
+
980
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
981
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
982
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
983
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
984
+ }
985
+
986
+ @Test
987
+ public void test_flex_direction_row_reverse_padding_right() {
988
+ YogaConfig config = YogaConfigFactory.create();
989
+
990
+ final YogaNode root = createNode(config);
991
+ root.setPositionType(YogaPositionType.ABSOLUTE);
992
+ root.setHeight(100f);
993
+ root.setWidth(100f);
994
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
995
+ root.setPadding(YogaEdge.RIGHT, 100);
996
+
997
+ final YogaNode root_child0 = createNode(config);
998
+ root_child0.setWidth(10f);
999
+ root.addChildAt(root_child0, 0);
1000
+
1001
+ final YogaNode root_child1 = createNode(config);
1002
+ root_child1.setWidth(10f);
1003
+ root.addChildAt(root_child1, 1);
1004
+
1005
+ final YogaNode root_child2 = createNode(config);
1006
+ root_child2.setWidth(10f);
1007
+ root.addChildAt(root_child2, 2);
1008
+ root.setDirection(YogaDirection.LTR);
1009
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1010
+
1011
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1012
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1013
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1014
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1015
+
1016
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
1017
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1018
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1019
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1020
+
1021
+ assertEquals(-20f, root_child1.getLayoutX(), 0.0f);
1022
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1023
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1024
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1025
+
1026
+ assertEquals(-30f, root_child2.getLayoutX(), 0.0f);
1027
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1028
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1029
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1030
+
1031
+ root.setDirection(YogaDirection.RTL);
1032
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1033
+
1034
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1035
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1036
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1037
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1038
+
1039
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1040
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1041
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1042
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1043
+
1044
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
1045
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1046
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1047
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1048
+
1049
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
1050
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1051
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1052
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1053
+ }
1054
+
1055
+ @Test
1056
+ public void test_flex_direction_row_reverse_padding_end() {
1057
+ YogaConfig config = YogaConfigFactory.create();
1058
+
1059
+ final YogaNode root = createNode(config);
1060
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1061
+ root.setHeight(100f);
1062
+ root.setWidth(100f);
1063
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1064
+ root.setPadding(YogaEdge.END, 100);
1065
+
1066
+ final YogaNode root_child0 = createNode(config);
1067
+ root_child0.setWidth(10f);
1068
+ root.addChildAt(root_child0, 0);
1069
+
1070
+ final YogaNode root_child1 = createNode(config);
1071
+ root_child1.setWidth(10f);
1072
+ root.addChildAt(root_child1, 1);
1073
+
1074
+ final YogaNode root_child2 = createNode(config);
1075
+ root_child2.setWidth(10f);
1076
+ root.addChildAt(root_child2, 2);
1077
+ root.setDirection(YogaDirection.LTR);
1078
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1079
+
1080
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1081
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1082
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1083
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1084
+
1085
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
1086
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1087
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1088
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1089
+
1090
+ assertEquals(-20f, root_child1.getLayoutX(), 0.0f);
1091
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1092
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1093
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1094
+
1095
+ assertEquals(-30f, root_child2.getLayoutX(), 0.0f);
1096
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1097
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1098
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1099
+
1100
+ root.setDirection(YogaDirection.RTL);
1101
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1102
+
1103
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1104
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1105
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1106
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1107
+
1108
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1109
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1110
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1111
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1112
+
1113
+ assertEquals(110f, root_child1.getLayoutX(), 0.0f);
1114
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1115
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1116
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1117
+
1118
+ assertEquals(120f, root_child2.getLayoutX(), 0.0f);
1119
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1120
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1121
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1122
+ }
1123
+
1124
+ @Test
1125
+ public void test_flex_direction_column_reverse_padding_top() {
1126
+ YogaConfig config = YogaConfigFactory.create();
1127
+
1128
+ final YogaNode root = createNode(config);
1129
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1130
+ root.setHeight(100f);
1131
+ root.setWidth(100f);
1132
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
1133
+ root.setPadding(YogaEdge.TOP, 100);
1134
+
1135
+ final YogaNode root_child0 = createNode(config);
1136
+ root_child0.setWidth(10f);
1137
+ root.addChildAt(root_child0, 0);
1138
+
1139
+ final YogaNode root_child1 = createNode(config);
1140
+ root_child1.setWidth(10f);
1141
+ root.addChildAt(root_child1, 1);
1142
+
1143
+ final YogaNode root_child2 = createNode(config);
1144
+ root_child2.setWidth(10f);
1145
+ root.addChildAt(root_child2, 2);
1146
+ root.setDirection(YogaDirection.LTR);
1147
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1148
+
1149
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1150
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1151
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1152
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1153
+
1154
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1155
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
1156
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1157
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1158
+
1159
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1160
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
1161
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1162
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1163
+
1164
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
1165
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
1166
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1167
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1168
+
1169
+ root.setDirection(YogaDirection.RTL);
1170
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1171
+
1172
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1173
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1174
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1175
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1176
+
1177
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
1178
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
1179
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1180
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1181
+
1182
+ assertEquals(90f, root_child1.getLayoutX(), 0.0f);
1183
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
1184
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1185
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1186
+
1187
+ assertEquals(90f, root_child2.getLayoutX(), 0.0f);
1188
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
1189
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1190
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1191
+ }
1192
+
1193
+ @Test
1194
+ public void test_flex_direction_column_reverse_padding_bottom() {
1195
+ YogaConfig config = YogaConfigFactory.create();
1196
+
1197
+ final YogaNode root = createNode(config);
1198
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1199
+ root.setHeight(100f);
1200
+ root.setWidth(100f);
1201
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
1202
+ root.setPadding(YogaEdge.BOTTOM, 100);
1203
+
1204
+ final YogaNode root_child0 = createNode(config);
1205
+ root_child0.setWidth(10f);
1206
+ root.addChildAt(root_child0, 0);
1207
+
1208
+ final YogaNode root_child1 = createNode(config);
1209
+ root_child1.setWidth(10f);
1210
+ root.addChildAt(root_child1, 1);
1211
+
1212
+ final YogaNode root_child2 = createNode(config);
1213
+ root_child2.setWidth(10f);
1214
+ root.addChildAt(root_child2, 2);
1215
+ root.setDirection(YogaDirection.LTR);
1216
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1217
+
1218
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1219
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1220
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1221
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1222
+
1223
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1224
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1225
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1226
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1227
+
1228
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1229
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1230
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1231
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1232
+
1233
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
1234
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1235
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1236
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1237
+
1238
+ root.setDirection(YogaDirection.RTL);
1239
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1240
+
1241
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1242
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1243
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1244
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1245
+
1246
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
1247
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1248
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1249
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1250
+
1251
+ assertEquals(90f, root_child1.getLayoutX(), 0.0f);
1252
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1253
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1254
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1255
+
1256
+ assertEquals(90f, root_child2.getLayoutX(), 0.0f);
1257
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1258
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1259
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1260
+ }
1261
+
1262
+ @Test
1263
+ public void test_flex_direction_row_reverse_border_left() {
1264
+ YogaConfig config = YogaConfigFactory.create();
1265
+
1266
+ final YogaNode root = createNode(config);
1267
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1268
+ root.setHeight(100f);
1269
+ root.setWidth(100f);
1270
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1271
+ root.setBorder(YogaEdge.LEFT, 100f);
1272
+
1273
+ final YogaNode root_child0 = createNode(config);
1274
+ root_child0.setWidth(10f);
1275
+ root.addChildAt(root_child0, 0);
1276
+
1277
+ final YogaNode root_child1 = createNode(config);
1278
+ root_child1.setWidth(10f);
1279
+ root.addChildAt(root_child1, 1);
1280
+
1281
+ final YogaNode root_child2 = createNode(config);
1282
+ root_child2.setWidth(10f);
1283
+ root.addChildAt(root_child2, 2);
1284
+ root.setDirection(YogaDirection.LTR);
1285
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1286
+
1287
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1288
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1289
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1290
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1291
+
1292
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
1293
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1294
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1295
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1296
+
1297
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
1298
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1299
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1300
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1301
+
1302
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
1303
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1304
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1305
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1306
+
1307
+ root.setDirection(YogaDirection.RTL);
1308
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1309
+
1310
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1311
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1312
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1313
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1314
+
1315
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1316
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1317
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1318
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1319
+
1320
+ assertEquals(110f, root_child1.getLayoutX(), 0.0f);
1321
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1322
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1323
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1324
+
1325
+ assertEquals(120f, root_child2.getLayoutX(), 0.0f);
1326
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1327
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1328
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1329
+ }
1330
+
1331
+ @Test
1332
+ public void test_flex_direction_row_reverse_border_start() {
1333
+ YogaConfig config = YogaConfigFactory.create();
1334
+
1335
+ final YogaNode root = createNode(config);
1336
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1337
+ root.setHeight(100f);
1338
+ root.setWidth(100f);
1339
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1340
+ root.setBorder(YogaEdge.START, 100f);
1341
+
1342
+ final YogaNode root_child0 = createNode(config);
1343
+ root_child0.setWidth(10f);
1344
+ root.addChildAt(root_child0, 0);
1345
+
1346
+ final YogaNode root_child1 = createNode(config);
1347
+ root_child1.setWidth(10f);
1348
+ root.addChildAt(root_child1, 1);
1349
+
1350
+ final YogaNode root_child2 = createNode(config);
1351
+ root_child2.setWidth(10f);
1352
+ root.addChildAt(root_child2, 2);
1353
+ root.setDirection(YogaDirection.LTR);
1354
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1355
+
1356
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1357
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1358
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1359
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1360
+
1361
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
1362
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1363
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1364
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1365
+
1366
+ assertEquals(80f, root_child1.getLayoutX(), 0.0f);
1367
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1368
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1369
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1370
+
1371
+ assertEquals(70f, root_child2.getLayoutX(), 0.0f);
1372
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1373
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1374
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1375
+
1376
+ root.setDirection(YogaDirection.RTL);
1377
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1378
+
1379
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1380
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1381
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1382
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1383
+
1384
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1385
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1386
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1387
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1388
+
1389
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
1390
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1391
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1392
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1393
+
1394
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
1395
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1396
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1397
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1398
+ }
1399
+
1400
+ @Test
1401
+ public void test_flex_direction_row_reverse_border_right() {
1402
+ YogaConfig config = YogaConfigFactory.create();
1403
+
1404
+ final YogaNode root = createNode(config);
1405
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1406
+ root.setHeight(100f);
1407
+ root.setWidth(100f);
1408
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1409
+ root.setBorder(YogaEdge.RIGHT, 100f);
1410
+
1411
+ final YogaNode root_child0 = createNode(config);
1412
+ root_child0.setWidth(10f);
1413
+ root.addChildAt(root_child0, 0);
1414
+
1415
+ final YogaNode root_child1 = createNode(config);
1416
+ root_child1.setWidth(10f);
1417
+ root.addChildAt(root_child1, 1);
1418
+
1419
+ final YogaNode root_child2 = createNode(config);
1420
+ root_child2.setWidth(10f);
1421
+ root.addChildAt(root_child2, 2);
1422
+ root.setDirection(YogaDirection.LTR);
1423
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1424
+
1425
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1426
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1427
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1428
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1429
+
1430
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
1431
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1432
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1433
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1434
+
1435
+ assertEquals(-20f, root_child1.getLayoutX(), 0.0f);
1436
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1437
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1438
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1439
+
1440
+ assertEquals(-30f, root_child2.getLayoutX(), 0.0f);
1441
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1442
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1443
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1444
+
1445
+ root.setDirection(YogaDirection.RTL);
1446
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1447
+
1448
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1449
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1450
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1451
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1452
+
1453
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1454
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1455
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1456
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1457
+
1458
+ assertEquals(10f, root_child1.getLayoutX(), 0.0f);
1459
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1460
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1461
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1462
+
1463
+ assertEquals(20f, root_child2.getLayoutX(), 0.0f);
1464
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1465
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1466
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1467
+ }
1468
+
1469
+ @Test
1470
+ public void test_flex_direction_row_reverse_border_end() {
1471
+ YogaConfig config = YogaConfigFactory.create();
1472
+
1473
+ final YogaNode root = createNode(config);
1474
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1475
+ root.setHeight(100f);
1476
+ root.setWidth(100f);
1477
+ root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1478
+ root.setBorder(YogaEdge.END, 100f);
1479
+
1480
+ final YogaNode root_child0 = createNode(config);
1481
+ root_child0.setWidth(10f);
1482
+ root.addChildAt(root_child0, 0);
1483
+
1484
+ final YogaNode root_child1 = createNode(config);
1485
+ root_child1.setWidth(10f);
1486
+ root.addChildAt(root_child1, 1);
1487
+
1488
+ final YogaNode root_child2 = createNode(config);
1489
+ root_child2.setWidth(10f);
1490
+ root.addChildAt(root_child2, 2);
1491
+ root.setDirection(YogaDirection.LTR);
1492
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1493
+
1494
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1495
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1496
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1497
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1498
+
1499
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
1500
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1501
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1502
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1503
+
1504
+ assertEquals(-20f, root_child1.getLayoutX(), 0.0f);
1505
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1506
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1507
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1508
+
1509
+ assertEquals(-30f, root_child2.getLayoutX(), 0.0f);
1510
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1511
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1512
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1513
+
1514
+ root.setDirection(YogaDirection.RTL);
1515
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1516
+
1517
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1518
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1519
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1520
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1521
+
1522
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1523
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1524
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1525
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1526
+
1527
+ assertEquals(110f, root_child1.getLayoutX(), 0.0f);
1528
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1529
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1530
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
1531
+
1532
+ assertEquals(120f, root_child2.getLayoutX(), 0.0f);
1533
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1534
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1535
+ assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
1536
+ }
1537
+
1538
+ @Test
1539
+ public void test_flex_direction_column_reverse_border_top() {
1540
+ YogaConfig config = YogaConfigFactory.create();
1541
+
1542
+ final YogaNode root = createNode(config);
1543
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1544
+ root.setHeight(100f);
1545
+ root.setWidth(100f);
1546
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
1547
+ root.setBorder(YogaEdge.TOP, 100f);
1548
+
1549
+ final YogaNode root_child0 = createNode(config);
1550
+ root_child0.setWidth(10f);
1551
+ root.addChildAt(root_child0, 0);
1552
+
1553
+ final YogaNode root_child1 = createNode(config);
1554
+ root_child1.setWidth(10f);
1555
+ root.addChildAt(root_child1, 1);
1556
+
1557
+ final YogaNode root_child2 = createNode(config);
1558
+ root_child2.setWidth(10f);
1559
+ root.addChildAt(root_child2, 2);
1560
+ root.setDirection(YogaDirection.LTR);
1561
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1562
+
1563
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1564
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1565
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1566
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1567
+
1568
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1569
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
1570
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1571
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1572
+
1573
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1574
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
1575
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1576
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1577
+
1578
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
1579
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
1580
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1581
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1582
+
1583
+ root.setDirection(YogaDirection.RTL);
1584
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1585
+
1586
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1587
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1588
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1589
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1590
+
1591
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
1592
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
1593
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1594
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1595
+
1596
+ assertEquals(90f, root_child1.getLayoutX(), 0.0f);
1597
+ assertEquals(100f, root_child1.getLayoutY(), 0.0f);
1598
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1599
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1600
+
1601
+ assertEquals(90f, root_child2.getLayoutX(), 0.0f);
1602
+ assertEquals(100f, root_child2.getLayoutY(), 0.0f);
1603
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1604
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1605
+ }
1606
+
1607
+ @Test
1608
+ public void test_flex_direction_column_reverse_border_bottom() {
1609
+ YogaConfig config = YogaConfigFactory.create();
1610
+
1611
+ final YogaNode root = createNode(config);
1612
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1613
+ root.setHeight(100f);
1614
+ root.setWidth(100f);
1615
+ root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
1616
+ root.setBorder(YogaEdge.BOTTOM, 100f);
1617
+
1618
+ final YogaNode root_child0 = createNode(config);
1619
+ root_child0.setWidth(10f);
1620
+ root.addChildAt(root_child0, 0);
1621
+
1622
+ final YogaNode root_child1 = createNode(config);
1623
+ root_child1.setWidth(10f);
1624
+ root.addChildAt(root_child1, 1);
1625
+
1626
+ final YogaNode root_child2 = createNode(config);
1627
+ root_child2.setWidth(10f);
1628
+ root.addChildAt(root_child2, 2);
1629
+ root.setDirection(YogaDirection.LTR);
1630
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1631
+
1632
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1633
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1634
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1635
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1636
+
1637
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
1638
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1639
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1640
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1641
+
1642
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
1643
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1644
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1645
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1646
+
1647
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
1648
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1649
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1650
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1651
+
1652
+ root.setDirection(YogaDirection.RTL);
1653
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1654
+
1655
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1656
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1657
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1658
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1659
+
1660
+ assertEquals(90f, root_child0.getLayoutX(), 0.0f);
1661
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1662
+ assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
1663
+ assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
1664
+
1665
+ assertEquals(90f, root_child1.getLayoutX(), 0.0f);
1666
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
1667
+ assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
1668
+ assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
1669
+
1670
+ assertEquals(90f, root_child2.getLayoutX(), 0.0f);
1671
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
1672
+ assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
1673
+ assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
1674
+ }
1675
+
1676
+ @Test
1677
+ public void test_flex_direction_row_reverse_pos_left() {
1678
+ YogaConfig config = YogaConfigFactory.create();
1679
+
1680
+ final YogaNode root = createNode(config);
1681
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1682
+ root.setHeight(100f);
1683
+ root.setWidth(100f);
1684
+
1685
+ final YogaNode root_child0 = createNode(config);
1686
+ root_child0.setHeight(100f);
1687
+ root_child0.setWidth(100f);
1688
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1689
+ root_child0.setPosition(YogaEdge.LEFT, 100f);
1690
+ root.addChildAt(root_child0, 0);
1691
+
1692
+ final YogaNode root_child0_child0 = createNode(config);
1693
+ root_child0_child0.setWidth(10f);
1694
+ root_child0.addChildAt(root_child0_child0, 0);
1695
+
1696
+ final YogaNode root_child0_child1 = createNode(config);
1697
+ root_child0_child1.setWidth(10f);
1698
+ root_child0.addChildAt(root_child0_child1, 1);
1699
+
1700
+ final YogaNode root_child0_child2 = createNode(config);
1701
+ root_child0_child2.setWidth(10f);
1702
+ root_child0.addChildAt(root_child0_child2, 2);
1703
+ root.setDirection(YogaDirection.LTR);
1704
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1705
+
1706
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1707
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1708
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1709
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1710
+
1711
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1712
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1713
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1714
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1715
+
1716
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
1717
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1718
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1719
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1720
+
1721
+ assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
1722
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1723
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1724
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1725
+
1726
+ assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
1727
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1728
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1729
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1730
+
1731
+ root.setDirection(YogaDirection.RTL);
1732
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1733
+
1734
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1735
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1736
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1737
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1738
+
1739
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1740
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1741
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1742
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1743
+
1744
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1745
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1746
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1747
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1748
+
1749
+ assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
1750
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1751
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1752
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1753
+
1754
+ assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
1755
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1756
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1757
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1758
+ }
1759
+
1760
+ @Test
1761
+ public void test_flex_direction_row_reverse_pos_start() {
1762
+ YogaConfig config = YogaConfigFactory.create();
1763
+
1764
+ final YogaNode root = createNode(config);
1765
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1766
+ root.setHeight(100f);
1767
+ root.setWidth(100f);
1768
+
1769
+ final YogaNode root_child0 = createNode(config);
1770
+ root_child0.setHeight(100f);
1771
+ root_child0.setWidth(100f);
1772
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1773
+ root_child0.setPosition(YogaEdge.START, 100f);
1774
+ root.addChildAt(root_child0, 0);
1775
+
1776
+ final YogaNode root_child0_child0 = createNode(config);
1777
+ root_child0_child0.setWidth(10f);
1778
+ root_child0.addChildAt(root_child0_child0, 0);
1779
+
1780
+ final YogaNode root_child0_child1 = createNode(config);
1781
+ root_child0_child1.setWidth(10f);
1782
+ root_child0.addChildAt(root_child0_child1, 1);
1783
+
1784
+ final YogaNode root_child0_child2 = createNode(config);
1785
+ root_child0_child2.setWidth(10f);
1786
+ root_child0.addChildAt(root_child0_child2, 2);
1787
+ root.setDirection(YogaDirection.LTR);
1788
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1789
+
1790
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1791
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1792
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1793
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1794
+
1795
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1796
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1797
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1798
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1799
+
1800
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
1801
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1802
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1803
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1804
+
1805
+ assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
1806
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1807
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1808
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1809
+
1810
+ assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
1811
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1812
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1813
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1814
+
1815
+ root.setDirection(YogaDirection.RTL);
1816
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1817
+
1818
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1819
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1820
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1821
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1822
+
1823
+ assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
1824
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1825
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1826
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1827
+
1828
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1829
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1830
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1831
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1832
+
1833
+ assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
1834
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1835
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1836
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1837
+
1838
+ assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
1839
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1840
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1841
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1842
+ }
1843
+
1844
+ @Test
1845
+ public void test_flex_direction_row_reverse_pos_right() {
1846
+ YogaConfig config = YogaConfigFactory.create();
1847
+
1848
+ final YogaNode root = createNode(config);
1849
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1850
+ root.setHeight(100f);
1851
+ root.setWidth(100f);
1852
+
1853
+ final YogaNode root_child0 = createNode(config);
1854
+ root_child0.setHeight(100f);
1855
+ root_child0.setWidth(100f);
1856
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1857
+ root_child0.setPosition(YogaEdge.RIGHT, 100f);
1858
+ root.addChildAt(root_child0, 0);
1859
+
1860
+ final YogaNode root_child0_child0 = createNode(config);
1861
+ root_child0_child0.setWidth(10f);
1862
+ root_child0.addChildAt(root_child0_child0, 0);
1863
+
1864
+ final YogaNode root_child0_child1 = createNode(config);
1865
+ root_child0_child1.setWidth(10f);
1866
+ root_child0.addChildAt(root_child0_child1, 1);
1867
+
1868
+ final YogaNode root_child0_child2 = createNode(config);
1869
+ root_child0_child2.setWidth(10f);
1870
+ root_child0.addChildAt(root_child0_child2, 2);
1871
+ root.setDirection(YogaDirection.LTR);
1872
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1873
+
1874
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1875
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1876
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1877
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1878
+
1879
+ assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
1880
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1881
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1882
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1883
+
1884
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
1885
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1886
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1887
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1888
+
1889
+ assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
1890
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1891
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1892
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1893
+
1894
+ assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
1895
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1896
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1897
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1898
+
1899
+ root.setDirection(YogaDirection.RTL);
1900
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1901
+
1902
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1903
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1904
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1905
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1906
+
1907
+ assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
1908
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1909
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1910
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1911
+
1912
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1913
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1914
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1915
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1916
+
1917
+ assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
1918
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1919
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1920
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1921
+
1922
+ assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
1923
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1924
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1925
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1926
+ }
1927
+
1928
+ @Test
1929
+ public void test_flex_direction_row_reverse_pos_end() {
1930
+ YogaConfig config = YogaConfigFactory.create();
1931
+
1932
+ final YogaNode root = createNode(config);
1933
+ root.setPositionType(YogaPositionType.ABSOLUTE);
1934
+ root.setHeight(100f);
1935
+ root.setWidth(100f);
1936
+
1937
+ final YogaNode root_child0 = createNode(config);
1938
+ root_child0.setHeight(100f);
1939
+ root_child0.setWidth(100f);
1940
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
1941
+ root_child0.setPosition(YogaEdge.END, 100f);
1942
+ root.addChildAt(root_child0, 0);
1943
+
1944
+ final YogaNode root_child0_child0 = createNode(config);
1945
+ root_child0_child0.setWidth(10f);
1946
+ root_child0.addChildAt(root_child0_child0, 0);
1947
+
1948
+ final YogaNode root_child0_child1 = createNode(config);
1949
+ root_child0_child1.setWidth(10f);
1950
+ root_child0.addChildAt(root_child0_child1, 1);
1951
+
1952
+ final YogaNode root_child0_child2 = createNode(config);
1953
+ root_child0_child2.setWidth(10f);
1954
+ root_child0.addChildAt(root_child0_child2, 2);
1955
+ root.setDirection(YogaDirection.LTR);
1956
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1957
+
1958
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1959
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1960
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1961
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1962
+
1963
+ assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
1964
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1965
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1966
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1967
+
1968
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
1969
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1970
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1971
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
1972
+
1973
+ assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
1974
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
1975
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
1976
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
1977
+
1978
+ assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
1979
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
1980
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
1981
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
1982
+
1983
+ root.setDirection(YogaDirection.RTL);
1984
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
1985
+
1986
+ assertEquals(0f, root.getLayoutX(), 0.0f);
1987
+ assertEquals(0f, root.getLayoutY(), 0.0f);
1988
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
1989
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
1990
+
1991
+ assertEquals(100f, root_child0.getLayoutX(), 0.0f);
1992
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
1993
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
1994
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
1995
+
1996
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
1997
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
1998
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
1999
+ assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
2000
+
2001
+ assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
2002
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2003
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2004
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2005
+
2006
+ assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
2007
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2008
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2009
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2010
+ }
2011
+
2012
+ @Test
2013
+ public void test_flex_direction_column_reverse_pos_top() {
2014
+ YogaConfig config = YogaConfigFactory.create();
2015
+
2016
+ final YogaNode root = createNode(config);
2017
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2018
+ root.setHeight(100f);
2019
+ root.setWidth(100f);
2020
+
2021
+ final YogaNode root_child0 = createNode(config);
2022
+ root_child0.setHeight(100f);
2023
+ root_child0.setWidth(100f);
2024
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
2025
+ root_child0.setPosition(YogaEdge.TOP, 100f);
2026
+ root.addChildAt(root_child0, 0);
2027
+
2028
+ final YogaNode root_child0_child0 = createNode(config);
2029
+ root_child0_child0.setWidth(10f);
2030
+ root_child0.addChildAt(root_child0_child0, 0);
2031
+
2032
+ final YogaNode root_child0_child1 = createNode(config);
2033
+ root_child0_child1.setWidth(10f);
2034
+ root_child0.addChildAt(root_child0_child1, 1);
2035
+
2036
+ final YogaNode root_child0_child2 = createNode(config);
2037
+ root_child0_child2.setWidth(10f);
2038
+ root_child0.addChildAt(root_child0_child2, 2);
2039
+ root.setDirection(YogaDirection.LTR);
2040
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2041
+
2042
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2043
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2044
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2045
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2046
+
2047
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2048
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
2049
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2050
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2051
+
2052
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2053
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
2054
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2055
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
2056
+
2057
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2058
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2059
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2060
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2061
+
2062
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
2063
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2064
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2065
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2066
+
2067
+ root.setDirection(YogaDirection.RTL);
2068
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2069
+
2070
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2071
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2072
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2073
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2074
+
2075
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2076
+ assertEquals(100f, root_child0.getLayoutY(), 0.0f);
2077
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2078
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2079
+
2080
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2081
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
2082
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2083
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
2084
+
2085
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2086
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2087
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2088
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2089
+
2090
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
2091
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2092
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2093
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2094
+ }
2095
+
2096
+ @Test
2097
+ public void test_flex_direction_column_reverse_pos_bottom() {
2098
+ YogaConfig config = YogaConfigFactory.create();
2099
+
2100
+ final YogaNode root = createNode(config);
2101
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2102
+ root.setHeight(100f);
2103
+ root.setWidth(100f);
2104
+
2105
+ final YogaNode root_child0 = createNode(config);
2106
+ root_child0.setHeight(100f);
2107
+ root_child0.setWidth(100f);
2108
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
2109
+ root_child0.setPosition(YogaEdge.BOTTOM, 100f);
2110
+ root.addChildAt(root_child0, 0);
2111
+
2112
+ final YogaNode root_child0_child0 = createNode(config);
2113
+ root_child0_child0.setWidth(10f);
2114
+ root_child0.addChildAt(root_child0_child0, 0);
2115
+
2116
+ final YogaNode root_child0_child1 = createNode(config);
2117
+ root_child0_child1.setWidth(10f);
2118
+ root_child0.addChildAt(root_child0_child1, 1);
2119
+
2120
+ final YogaNode root_child0_child2 = createNode(config);
2121
+ root_child0_child2.setWidth(10f);
2122
+ root_child0.addChildAt(root_child0_child2, 2);
2123
+ root.setDirection(YogaDirection.LTR);
2124
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2125
+
2126
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2127
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2128
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2129
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2130
+
2131
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2132
+ assertEquals(-100f, root_child0.getLayoutY(), 0.0f);
2133
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2134
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2135
+
2136
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2137
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
2138
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2139
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
2140
+
2141
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2142
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2143
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2144
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2145
+
2146
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
2147
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2148
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2149
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2150
+
2151
+ root.setDirection(YogaDirection.RTL);
2152
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2153
+
2154
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2155
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2156
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2157
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2158
+
2159
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2160
+ assertEquals(-100f, root_child0.getLayoutY(), 0.0f);
2161
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2162
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2163
+
2164
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2165
+ assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
2166
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2167
+ assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
2168
+
2169
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2170
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2171
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2172
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2173
+
2174
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
2175
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2176
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2177
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2178
+ }
2179
+
2180
+ @Test
2181
+ public void test_flex_direction_row_reverse_inner_pos_left() {
2182
+ YogaConfig config = YogaConfigFactory.create();
2183
+
2184
+ final YogaNode root = createNode(config);
2185
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2186
+ root.setHeight(100f);
2187
+ root.setWidth(100f);
2188
+
2189
+ final YogaNode root_child0 = createNode(config);
2190
+ root_child0.setHeight(100f);
2191
+ root_child0.setWidth(100f);
2192
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
2193
+ root.addChildAt(root_child0, 0);
2194
+
2195
+ final YogaNode root_child0_child0 = createNode(config);
2196
+ root_child0_child0.setWidth(10f);
2197
+ root_child0_child0.setHeight(10f);
2198
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2199
+ root_child0_child0.setPosition(YogaEdge.LEFT, 10f);
2200
+ root_child0.addChildAt(root_child0_child0, 0);
2201
+
2202
+ final YogaNode root_child0_child1 = createNode(config);
2203
+ root_child0_child1.setWidth(10f);
2204
+ root_child0.addChildAt(root_child0_child1, 1);
2205
+
2206
+ final YogaNode root_child0_child2 = createNode(config);
2207
+ root_child0_child2.setWidth(10f);
2208
+ root_child0.addChildAt(root_child0_child2, 2);
2209
+ root.setDirection(YogaDirection.LTR);
2210
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2211
+
2212
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2213
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2214
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2215
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2216
+
2217
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2218
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2219
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2220
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2221
+
2222
+ assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f);
2223
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2224
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2225
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2226
+
2227
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2228
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2229
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2230
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2231
+
2232
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
2233
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2234
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2235
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2236
+
2237
+ root.setDirection(YogaDirection.RTL);
2238
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2239
+
2240
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2241
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2242
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2243
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2244
+
2245
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2246
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2247
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2248
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2249
+
2250
+ assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f);
2251
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2252
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2253
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2254
+
2255
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2256
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2257
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2258
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2259
+
2260
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
2261
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2262
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2263
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2264
+ }
2265
+
2266
+ @Test
2267
+ public void test_flex_direction_row_reverse_inner_pos_right() {
2268
+ YogaConfig config = YogaConfigFactory.create();
2269
+
2270
+ final YogaNode root = createNode(config);
2271
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2272
+ root.setHeight(100f);
2273
+ root.setWidth(100f);
2274
+
2275
+ final YogaNode root_child0 = createNode(config);
2276
+ root_child0.setHeight(100f);
2277
+ root_child0.setWidth(100f);
2278
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
2279
+ root.addChildAt(root_child0, 0);
2280
+
2281
+ final YogaNode root_child0_child0 = createNode(config);
2282
+ root_child0_child0.setWidth(10f);
2283
+ root_child0_child0.setHeight(10f);
2284
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2285
+ root_child0_child0.setPosition(YogaEdge.RIGHT, 10f);
2286
+ root_child0.addChildAt(root_child0_child0, 0);
2287
+
2288
+ final YogaNode root_child0_child1 = createNode(config);
2289
+ root_child0_child1.setWidth(10f);
2290
+ root_child0.addChildAt(root_child0_child1, 1);
2291
+
2292
+ final YogaNode root_child0_child2 = createNode(config);
2293
+ root_child0_child2.setWidth(10f);
2294
+ root_child0.addChildAt(root_child0_child2, 2);
2295
+ root.setDirection(YogaDirection.LTR);
2296
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2297
+
2298
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2299
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2300
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2301
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2302
+
2303
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2304
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2305
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2306
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2307
+
2308
+ assertEquals(80f, root_child0_child0.getLayoutX(), 0.0f);
2309
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2310
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2311
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2312
+
2313
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2314
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2315
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2316
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2317
+
2318
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
2319
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2320
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2321
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2322
+
2323
+ root.setDirection(YogaDirection.RTL);
2324
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2325
+
2326
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2327
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2328
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2329
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2330
+
2331
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2332
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2333
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2334
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2335
+
2336
+ assertEquals(80f, root_child0_child0.getLayoutX(), 0.0f);
2337
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2338
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2339
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2340
+
2341
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2342
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2343
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2344
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2345
+
2346
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
2347
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2348
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2349
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2350
+ }
2351
+
2352
+ @Test
2353
+ public void test_flex_direction_col_reverse_inner_pos_top() {
2354
+ YogaConfig config = YogaConfigFactory.create();
2355
+
2356
+ final YogaNode root = createNode(config);
2357
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2358
+ root.setHeight(100f);
2359
+ root.setWidth(100f);
2360
+
2361
+ final YogaNode root_child0 = createNode(config);
2362
+ root_child0.setHeight(100f);
2363
+ root_child0.setWidth(100f);
2364
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
2365
+ root.addChildAt(root_child0, 0);
2366
+
2367
+ final YogaNode root_child0_child0 = createNode(config);
2368
+ root_child0_child0.setWidth(10f);
2369
+ root_child0_child0.setHeight(10f);
2370
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2371
+ root_child0_child0.setPosition(YogaEdge.TOP, 10f);
2372
+ root_child0.addChildAt(root_child0_child0, 0);
2373
+
2374
+ final YogaNode root_child0_child1 = createNode(config);
2375
+ root_child0_child1.setWidth(10f);
2376
+ root_child0.addChildAt(root_child0_child1, 1);
2377
+
2378
+ final YogaNode root_child0_child2 = createNode(config);
2379
+ root_child0_child2.setWidth(10f);
2380
+ root_child0.addChildAt(root_child0_child2, 2);
2381
+ root.setDirection(YogaDirection.LTR);
2382
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2383
+
2384
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2385
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2386
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2387
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2388
+
2389
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2390
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2391
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2392
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2393
+
2394
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2395
+ assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f);
2396
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2397
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2398
+
2399
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2400
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2401
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2402
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2403
+
2404
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
2405
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2406
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2407
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2408
+
2409
+ root.setDirection(YogaDirection.RTL);
2410
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2411
+
2412
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2413
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2414
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2415
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2416
+
2417
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2418
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2419
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2420
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2421
+
2422
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2423
+ assertEquals(10f, root_child0_child0.getLayoutY(), 0.0f);
2424
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2425
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2426
+
2427
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2428
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2429
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2430
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2431
+
2432
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
2433
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2434
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2435
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2436
+ }
2437
+
2438
+ @Test
2439
+ public void test_flex_direction_col_reverse_inner_pos_bottom() {
2440
+ YogaConfig config = YogaConfigFactory.create();
2441
+
2442
+ final YogaNode root = createNode(config);
2443
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2444
+ root.setHeight(100f);
2445
+ root.setWidth(100f);
2446
+
2447
+ final YogaNode root_child0 = createNode(config);
2448
+ root_child0.setHeight(100f);
2449
+ root_child0.setWidth(100f);
2450
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
2451
+ root.addChildAt(root_child0, 0);
2452
+
2453
+ final YogaNode root_child0_child0 = createNode(config);
2454
+ root_child0_child0.setWidth(10f);
2455
+ root_child0_child0.setHeight(10f);
2456
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2457
+ root_child0_child0.setPosition(YogaEdge.BOTTOM, 10f);
2458
+ root_child0.addChildAt(root_child0_child0, 0);
2459
+
2460
+ final YogaNode root_child0_child1 = createNode(config);
2461
+ root_child0_child1.setWidth(10f);
2462
+ root_child0.addChildAt(root_child0_child1, 1);
2463
+
2464
+ final YogaNode root_child0_child2 = createNode(config);
2465
+ root_child0_child2.setWidth(10f);
2466
+ root_child0.addChildAt(root_child0_child2, 2);
2467
+ root.setDirection(YogaDirection.LTR);
2468
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2469
+
2470
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2471
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2472
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2473
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2474
+
2475
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2476
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2477
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2478
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2479
+
2480
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2481
+ assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f);
2482
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2483
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2484
+
2485
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2486
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2487
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2488
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2489
+
2490
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
2491
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2492
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2493
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2494
+
2495
+ root.setDirection(YogaDirection.RTL);
2496
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2497
+
2498
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2499
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2500
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2501
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2502
+
2503
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2504
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2505
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2506
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2507
+
2508
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2509
+ assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f);
2510
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2511
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2512
+
2513
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2514
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2515
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2516
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2517
+
2518
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
2519
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2520
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2521
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2522
+ }
2523
+
2524
+ @Test
2525
+ public void test_flex_direction_row_reverse_inner_margin_left() {
2526
+ YogaConfig config = YogaConfigFactory.create();
2527
+
2528
+ final YogaNode root = createNode(config);
2529
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2530
+ root.setHeight(100f);
2531
+ root.setWidth(100f);
2532
+
2533
+ final YogaNode root_child0 = createNode(config);
2534
+ root_child0.setHeight(100f);
2535
+ root_child0.setWidth(100f);
2536
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
2537
+ root.addChildAt(root_child0, 0);
2538
+
2539
+ final YogaNode root_child0_child0 = createNode(config);
2540
+ root_child0_child0.setWidth(10f);
2541
+ root_child0_child0.setHeight(10f);
2542
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2543
+ root_child0_child0.setMargin(YogaEdge.LEFT, 10f);
2544
+ root_child0.addChildAt(root_child0_child0, 0);
2545
+
2546
+ final YogaNode root_child0_child1 = createNode(config);
2547
+ root_child0_child1.setWidth(10f);
2548
+ root_child0.addChildAt(root_child0_child1, 1);
2549
+
2550
+ final YogaNode root_child0_child2 = createNode(config);
2551
+ root_child0_child2.setWidth(10f);
2552
+ root_child0.addChildAt(root_child0_child2, 2);
2553
+ root.setDirection(YogaDirection.LTR);
2554
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2555
+
2556
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2557
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2558
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2559
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2560
+
2561
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2562
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2563
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2564
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2565
+
2566
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2567
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2568
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2569
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2570
+
2571
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2572
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2573
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2574
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2575
+
2576
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
2577
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2578
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2579
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2580
+
2581
+ root.setDirection(YogaDirection.RTL);
2582
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2583
+
2584
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2585
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2586
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2587
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2588
+
2589
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2590
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2591
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2592
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2593
+
2594
+ assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f);
2595
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2596
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2597
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2598
+
2599
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2600
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2601
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2602
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2603
+
2604
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
2605
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2606
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2607
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2608
+ }
2609
+
2610
+ @Test
2611
+ public void test_flex_direction_row_reverse_inner_margin_right() {
2612
+ YogaConfig config = YogaConfigFactory.create();
2613
+
2614
+ final YogaNode root = createNode(config);
2615
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2616
+ root.setHeight(100f);
2617
+ root.setWidth(100f);
2618
+
2619
+ final YogaNode root_child0 = createNode(config);
2620
+ root_child0.setHeight(100f);
2621
+ root_child0.setWidth(100f);
2622
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
2623
+ root.addChildAt(root_child0, 0);
2624
+
2625
+ final YogaNode root_child0_child0 = createNode(config);
2626
+ root_child0_child0.setWidth(10f);
2627
+ root_child0_child0.setHeight(10f);
2628
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2629
+ root_child0_child0.setMargin(YogaEdge.RIGHT, 10f);
2630
+ root_child0.addChildAt(root_child0_child0, 0);
2631
+
2632
+ final YogaNode root_child0_child1 = createNode(config);
2633
+ root_child0_child1.setWidth(10f);
2634
+ root_child0.addChildAt(root_child0_child1, 1);
2635
+
2636
+ final YogaNode root_child0_child2 = createNode(config);
2637
+ root_child0_child2.setWidth(10f);
2638
+ root_child0.addChildAt(root_child0_child2, 2);
2639
+ root.setDirection(YogaDirection.LTR);
2640
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2641
+
2642
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2643
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2644
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2645
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2646
+
2647
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2648
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2649
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2650
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2651
+
2652
+ assertEquals(80f, root_child0_child0.getLayoutX(), 0.0f);
2653
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2654
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2655
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2656
+
2657
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2658
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2659
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2660
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2661
+
2662
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
2663
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2664
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2665
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2666
+
2667
+ root.setDirection(YogaDirection.RTL);
2668
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2669
+
2670
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2671
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2672
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2673
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2674
+
2675
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2676
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2677
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2678
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2679
+
2680
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2681
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2682
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2683
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2684
+
2685
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2686
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2687
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2688
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2689
+
2690
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
2691
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2692
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2693
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2694
+ }
2695
+
2696
+ @Test
2697
+ public void test_flex_direction_col_reverse_inner_margin_top() {
2698
+ YogaConfig config = YogaConfigFactory.create();
2699
+
2700
+ final YogaNode root = createNode(config);
2701
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2702
+ root.setHeight(100f);
2703
+ root.setWidth(100f);
2704
+
2705
+ final YogaNode root_child0 = createNode(config);
2706
+ root_child0.setHeight(100f);
2707
+ root_child0.setWidth(100f);
2708
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
2709
+ root.addChildAt(root_child0, 0);
2710
+
2711
+ final YogaNode root_child0_child0 = createNode(config);
2712
+ root_child0_child0.setWidth(10f);
2713
+ root_child0_child0.setHeight(10f);
2714
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2715
+ root_child0_child0.setMargin(YogaEdge.TOP, 10f);
2716
+ root_child0.addChildAt(root_child0_child0, 0);
2717
+
2718
+ final YogaNode root_child0_child1 = createNode(config);
2719
+ root_child0_child1.setWidth(10f);
2720
+ root_child0.addChildAt(root_child0_child1, 1);
2721
+
2722
+ final YogaNode root_child0_child2 = createNode(config);
2723
+ root_child0_child2.setWidth(10f);
2724
+ root_child0.addChildAt(root_child0_child2, 2);
2725
+ root.setDirection(YogaDirection.LTR);
2726
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2727
+
2728
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2729
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2730
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2731
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2732
+
2733
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2734
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2735
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2736
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2737
+
2738
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2739
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
2740
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2741
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2742
+
2743
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2744
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2745
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2746
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2747
+
2748
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
2749
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2750
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2751
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2752
+
2753
+ root.setDirection(YogaDirection.RTL);
2754
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2755
+
2756
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2757
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2758
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2759
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2760
+
2761
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2762
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2763
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2764
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2765
+
2766
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2767
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
2768
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2769
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2770
+
2771
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2772
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2773
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2774
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2775
+
2776
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
2777
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2778
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2779
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2780
+ }
2781
+
2782
+ @Test
2783
+ public void test_flex_direction_col_reverse_inner_margin_bottom() {
2784
+ YogaConfig config = YogaConfigFactory.create();
2785
+
2786
+ final YogaNode root = createNode(config);
2787
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2788
+ root.setHeight(100f);
2789
+ root.setWidth(100f);
2790
+
2791
+ final YogaNode root_child0 = createNode(config);
2792
+ root_child0.setHeight(100f);
2793
+ root_child0.setWidth(100f);
2794
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
2795
+ root.addChildAt(root_child0, 0);
2796
+
2797
+ final YogaNode root_child0_child0 = createNode(config);
2798
+ root_child0_child0.setWidth(10f);
2799
+ root_child0_child0.setHeight(10f);
2800
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2801
+ root_child0_child0.setMargin(YogaEdge.BOTTOM, 10f);
2802
+ root_child0.addChildAt(root_child0_child0, 0);
2803
+
2804
+ final YogaNode root_child0_child1 = createNode(config);
2805
+ root_child0_child1.setWidth(10f);
2806
+ root_child0.addChildAt(root_child0_child1, 1);
2807
+
2808
+ final YogaNode root_child0_child2 = createNode(config);
2809
+ root_child0_child2.setWidth(10f);
2810
+ root_child0.addChildAt(root_child0_child2, 2);
2811
+ root.setDirection(YogaDirection.LTR);
2812
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2813
+
2814
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2815
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2816
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2817
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2818
+
2819
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2820
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2821
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2822
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2823
+
2824
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2825
+ assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f);
2826
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2827
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2828
+
2829
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2830
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2831
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2832
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2833
+
2834
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
2835
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2836
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2837
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2838
+
2839
+ root.setDirection(YogaDirection.RTL);
2840
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2841
+
2842
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2843
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2844
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2845
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2846
+
2847
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2848
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2849
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2850
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2851
+
2852
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2853
+ assertEquals(80f, root_child0_child0.getLayoutY(), 0.0f);
2854
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2855
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2856
+
2857
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2858
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
2859
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2860
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
2861
+
2862
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
2863
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
2864
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2865
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
2866
+ }
2867
+
2868
+ @Test
2869
+ public void test_flex_direction_row_reverse_inner_marign_start() {
2870
+ YogaConfig config = YogaConfigFactory.create();
2871
+
2872
+ final YogaNode root = createNode(config);
2873
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2874
+ root.setHeight(100f);
2875
+ root.setWidth(100f);
2876
+
2877
+ final YogaNode root_child0 = createNode(config);
2878
+ root_child0.setHeight(100f);
2879
+ root_child0.setWidth(100f);
2880
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
2881
+ root.addChildAt(root_child0, 0);
2882
+
2883
+ final YogaNode root_child0_child0 = createNode(config);
2884
+ root_child0_child0.setWidth(10f);
2885
+ root_child0_child0.setHeight(10f);
2886
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2887
+ root_child0_child0.setMargin(YogaEdge.START, 10f);
2888
+ root_child0.addChildAt(root_child0_child0, 0);
2889
+
2890
+ final YogaNode root_child0_child1 = createNode(config);
2891
+ root_child0_child1.setWidth(10f);
2892
+ root_child0.addChildAt(root_child0_child1, 1);
2893
+
2894
+ final YogaNode root_child0_child2 = createNode(config);
2895
+ root_child0_child2.setWidth(10f);
2896
+ root_child0.addChildAt(root_child0_child2, 2);
2897
+ root.setDirection(YogaDirection.LTR);
2898
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2899
+
2900
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2901
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2902
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2903
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2904
+
2905
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2906
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2907
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2908
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2909
+
2910
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
2911
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2912
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2913
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2914
+
2915
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
2916
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2917
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2918
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2919
+
2920
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
2921
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2922
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2923
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2924
+
2925
+ root.setDirection(YogaDirection.RTL);
2926
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2927
+
2928
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2929
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2930
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2931
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2932
+
2933
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2934
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2935
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2936
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2937
+
2938
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
2939
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2940
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2941
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
2942
+
2943
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
2944
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
2945
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
2946
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
2947
+
2948
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
2949
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
2950
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
2951
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
2952
+ }
2953
+
2954
+ @Test
2955
+ public void test_flex_direction_row_reverse_inner_margin_end() {
2956
+ YogaConfig config = YogaConfigFactory.create();
2957
+
2958
+ final YogaNode root = createNode(config);
2959
+ root.setPositionType(YogaPositionType.ABSOLUTE);
2960
+ root.setHeight(100f);
2961
+ root.setWidth(100f);
2962
+
2963
+ final YogaNode root_child0 = createNode(config);
2964
+ root_child0.setHeight(100f);
2965
+ root_child0.setWidth(100f);
2966
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
2967
+ root.addChildAt(root_child0, 0);
2968
+
2969
+ final YogaNode root_child0_child0 = createNode(config);
2970
+ root_child0_child0.setWidth(10f);
2971
+ root_child0_child0.setHeight(10f);
2972
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
2973
+ root_child0_child0.setMargin(YogaEdge.END, 10f);
2974
+ root_child0.addChildAt(root_child0_child0, 0);
2975
+
2976
+ final YogaNode root_child0_child1 = createNode(config);
2977
+ root_child0_child1.setWidth(10f);
2978
+ root_child0.addChildAt(root_child0_child1, 1);
2979
+
2980
+ final YogaNode root_child0_child2 = createNode(config);
2981
+ root_child0_child2.setWidth(10f);
2982
+ root_child0.addChildAt(root_child0_child2, 2);
2983
+ root.setDirection(YogaDirection.LTR);
2984
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
2985
+
2986
+ assertEquals(0f, root.getLayoutX(), 0.0f);
2987
+ assertEquals(0f, root.getLayoutY(), 0.0f);
2988
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
2989
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
2990
+
2991
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
2992
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
2993
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
2994
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
2995
+
2996
+ assertEquals(80f, root_child0_child0.getLayoutX(), 0.0f);
2997
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
2998
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
2999
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3000
+
3001
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3002
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3003
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3004
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3005
+
3006
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3007
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3008
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3009
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3010
+
3011
+ root.setDirection(YogaDirection.RTL);
3012
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3013
+
3014
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3015
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3016
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3017
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3018
+
3019
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3020
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3021
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3022
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3023
+
3024
+ assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f);
3025
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3026
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3027
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3028
+
3029
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3030
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3031
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3032
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3033
+
3034
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3035
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3036
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3037
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3038
+ }
3039
+
3040
+ @Test
3041
+ public void test_flex_direction_row_reverse_inner_border_left() {
3042
+ YogaConfig config = YogaConfigFactory.create();
3043
+
3044
+ final YogaNode root = createNode(config);
3045
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3046
+ root.setHeight(100f);
3047
+ root.setWidth(100f);
3048
+
3049
+ final YogaNode root_child0 = createNode(config);
3050
+ root_child0.setHeight(100f);
3051
+ root_child0.setWidth(100f);
3052
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3053
+ root.addChildAt(root_child0, 0);
3054
+
3055
+ final YogaNode root_child0_child0 = createNode(config);
3056
+ root_child0_child0.setWidth(10f);
3057
+ root_child0_child0.setHeight(10f);
3058
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3059
+ root_child0_child0.setBorder(YogaEdge.LEFT, 10f);
3060
+ root_child0.addChildAt(root_child0_child0, 0);
3061
+
3062
+ final YogaNode root_child0_child1 = createNode(config);
3063
+ root_child0_child1.setWidth(10f);
3064
+ root_child0.addChildAt(root_child0_child1, 1);
3065
+
3066
+ final YogaNode root_child0_child2 = createNode(config);
3067
+ root_child0_child2.setWidth(10f);
3068
+ root_child0.addChildAt(root_child0_child2, 2);
3069
+ root.setDirection(YogaDirection.LTR);
3070
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3071
+
3072
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3073
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3074
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3075
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3076
+
3077
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3078
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3079
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3080
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3081
+
3082
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3083
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3084
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3085
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3086
+
3087
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3088
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3089
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3090
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3091
+
3092
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3093
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3094
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3095
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3096
+
3097
+ root.setDirection(YogaDirection.RTL);
3098
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3099
+
3100
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3101
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3102
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3103
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3104
+
3105
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3106
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3107
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3108
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3109
+
3110
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3111
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3112
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3113
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3114
+
3115
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3116
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3117
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3118
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3119
+
3120
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3121
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3122
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3123
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3124
+ }
3125
+
3126
+ @Test
3127
+ public void test_flex_direction_row_reverse_inner_border_right() {
3128
+ YogaConfig config = YogaConfigFactory.create();
3129
+
3130
+ final YogaNode root = createNode(config);
3131
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3132
+ root.setHeight(100f);
3133
+ root.setWidth(100f);
3134
+
3135
+ final YogaNode root_child0 = createNode(config);
3136
+ root_child0.setHeight(100f);
3137
+ root_child0.setWidth(100f);
3138
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3139
+ root.addChildAt(root_child0, 0);
3140
+
3141
+ final YogaNode root_child0_child0 = createNode(config);
3142
+ root_child0_child0.setWidth(10f);
3143
+ root_child0_child0.setHeight(10f);
3144
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3145
+ root_child0_child0.setBorder(YogaEdge.RIGHT, 10f);
3146
+ root_child0.addChildAt(root_child0_child0, 0);
3147
+
3148
+ final YogaNode root_child0_child1 = createNode(config);
3149
+ root_child0_child1.setWidth(10f);
3150
+ root_child0.addChildAt(root_child0_child1, 1);
3151
+
3152
+ final YogaNode root_child0_child2 = createNode(config);
3153
+ root_child0_child2.setWidth(10f);
3154
+ root_child0.addChildAt(root_child0_child2, 2);
3155
+ root.setDirection(YogaDirection.LTR);
3156
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3157
+
3158
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3159
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3160
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3161
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3162
+
3163
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3164
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3165
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3166
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3167
+
3168
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3169
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3170
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3171
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3172
+
3173
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3174
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3175
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3176
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3177
+
3178
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3179
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3180
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3181
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3182
+
3183
+ root.setDirection(YogaDirection.RTL);
3184
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3185
+
3186
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3187
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3188
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3189
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3190
+
3191
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3192
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3193
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3194
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3195
+
3196
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3197
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3198
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3199
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3200
+
3201
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3202
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3203
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3204
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3205
+
3206
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3207
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3208
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3209
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3210
+ }
3211
+
3212
+ @Test
3213
+ public void test_flex_direction_col_reverse_inner_border_top() {
3214
+ YogaConfig config = YogaConfigFactory.create();
3215
+
3216
+ final YogaNode root = createNode(config);
3217
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3218
+ root.setHeight(100f);
3219
+ root.setWidth(100f);
3220
+
3221
+ final YogaNode root_child0 = createNode(config);
3222
+ root_child0.setHeight(100f);
3223
+ root_child0.setWidth(100f);
3224
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
3225
+ root.addChildAt(root_child0, 0);
3226
+
3227
+ final YogaNode root_child0_child0 = createNode(config);
3228
+ root_child0_child0.setWidth(10f);
3229
+ root_child0_child0.setHeight(10f);
3230
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3231
+ root_child0_child0.setBorder(YogaEdge.TOP, 10f);
3232
+ root_child0.addChildAt(root_child0_child0, 0);
3233
+
3234
+ final YogaNode root_child0_child1 = createNode(config);
3235
+ root_child0_child1.setWidth(10f);
3236
+ root_child0.addChildAt(root_child0_child1, 1);
3237
+
3238
+ final YogaNode root_child0_child2 = createNode(config);
3239
+ root_child0_child2.setWidth(10f);
3240
+ root_child0.addChildAt(root_child0_child2, 2);
3241
+ root.setDirection(YogaDirection.LTR);
3242
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3243
+
3244
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3245
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3246
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3247
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3248
+
3249
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3250
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3251
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3252
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3253
+
3254
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3255
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3256
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3257
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3258
+
3259
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3260
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3261
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3262
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3263
+
3264
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
3265
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3266
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3267
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3268
+
3269
+ root.setDirection(YogaDirection.RTL);
3270
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3271
+
3272
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3273
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3274
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3275
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3276
+
3277
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3278
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3279
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3280
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3281
+
3282
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3283
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3284
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3285
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3286
+
3287
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3288
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3289
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3290
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3291
+
3292
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
3293
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3294
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3295
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3296
+ }
3297
+
3298
+ @Test
3299
+ public void test_flex_direction_col_reverse_inner_border_bottom() {
3300
+ YogaConfig config = YogaConfigFactory.create();
3301
+
3302
+ final YogaNode root = createNode(config);
3303
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3304
+ root.setHeight(100f);
3305
+ root.setWidth(100f);
3306
+
3307
+ final YogaNode root_child0 = createNode(config);
3308
+ root_child0.setHeight(100f);
3309
+ root_child0.setWidth(100f);
3310
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
3311
+ root.addChildAt(root_child0, 0);
3312
+
3313
+ final YogaNode root_child0_child0 = createNode(config);
3314
+ root_child0_child0.setWidth(10f);
3315
+ root_child0_child0.setHeight(10f);
3316
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3317
+ root_child0_child0.setBorder(YogaEdge.BOTTOM, 10f);
3318
+ root_child0.addChildAt(root_child0_child0, 0);
3319
+
3320
+ final YogaNode root_child0_child1 = createNode(config);
3321
+ root_child0_child1.setWidth(10f);
3322
+ root_child0.addChildAt(root_child0_child1, 1);
3323
+
3324
+ final YogaNode root_child0_child2 = createNode(config);
3325
+ root_child0_child2.setWidth(10f);
3326
+ root_child0.addChildAt(root_child0_child2, 2);
3327
+ root.setDirection(YogaDirection.LTR);
3328
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3329
+
3330
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3331
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3332
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3333
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3334
+
3335
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3336
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3337
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3338
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3339
+
3340
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3341
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3342
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3343
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3344
+
3345
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3346
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3347
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3348
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3349
+
3350
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
3351
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3352
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3353
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3354
+
3355
+ root.setDirection(YogaDirection.RTL);
3356
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3357
+
3358
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3359
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3360
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3361
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3362
+
3363
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3364
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3365
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3366
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3367
+
3368
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3369
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3370
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3371
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3372
+
3373
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3374
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3375
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3376
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3377
+
3378
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
3379
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3380
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3381
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3382
+ }
3383
+
3384
+ @Test
3385
+ public void test_flex_direction_row_reverse_inner_border_start() {
3386
+ YogaConfig config = YogaConfigFactory.create();
3387
+
3388
+ final YogaNode root = createNode(config);
3389
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3390
+ root.setHeight(100f);
3391
+ root.setWidth(100f);
3392
+
3393
+ final YogaNode root_child0 = createNode(config);
3394
+ root_child0.setHeight(100f);
3395
+ root_child0.setWidth(100f);
3396
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3397
+ root.addChildAt(root_child0, 0);
3398
+
3399
+ final YogaNode root_child0_child0 = createNode(config);
3400
+ root_child0_child0.setWidth(10f);
3401
+ root_child0_child0.setHeight(10f);
3402
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3403
+ root_child0_child0.setBorder(YogaEdge.START, 10f);
3404
+ root_child0.addChildAt(root_child0_child0, 0);
3405
+
3406
+ final YogaNode root_child0_child1 = createNode(config);
3407
+ root_child0_child1.setWidth(10f);
3408
+ root_child0.addChildAt(root_child0_child1, 1);
3409
+
3410
+ final YogaNode root_child0_child2 = createNode(config);
3411
+ root_child0_child2.setWidth(10f);
3412
+ root_child0.addChildAt(root_child0_child2, 2);
3413
+ root.setDirection(YogaDirection.LTR);
3414
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3415
+
3416
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3417
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3418
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3419
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3420
+
3421
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3422
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3423
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3424
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3425
+
3426
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3427
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3428
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3429
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3430
+
3431
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3432
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3433
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3434
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3435
+
3436
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3437
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3438
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3439
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3440
+
3441
+ root.setDirection(YogaDirection.RTL);
3442
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3443
+
3444
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3445
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3446
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3447
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3448
+
3449
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3450
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3451
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3452
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3453
+
3454
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3455
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3456
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3457
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3458
+
3459
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3460
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3461
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3462
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3463
+
3464
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3465
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3466
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3467
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3468
+ }
3469
+
3470
+ @Test
3471
+ public void test_flex_direction_row_reverse_inner_border_end() {
3472
+ YogaConfig config = YogaConfigFactory.create();
3473
+
3474
+ final YogaNode root = createNode(config);
3475
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3476
+ root.setHeight(100f);
3477
+ root.setWidth(100f);
3478
+
3479
+ final YogaNode root_child0 = createNode(config);
3480
+ root_child0.setHeight(100f);
3481
+ root_child0.setWidth(100f);
3482
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3483
+ root.addChildAt(root_child0, 0);
3484
+
3485
+ final YogaNode root_child0_child0 = createNode(config);
3486
+ root_child0_child0.setWidth(10f);
3487
+ root_child0_child0.setHeight(10f);
3488
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3489
+ root_child0_child0.setBorder(YogaEdge.END, 10f);
3490
+ root_child0.addChildAt(root_child0_child0, 0);
3491
+
3492
+ final YogaNode root_child0_child1 = createNode(config);
3493
+ root_child0_child1.setWidth(10f);
3494
+ root_child0.addChildAt(root_child0_child1, 1);
3495
+
3496
+ final YogaNode root_child0_child2 = createNode(config);
3497
+ root_child0_child2.setWidth(10f);
3498
+ root_child0.addChildAt(root_child0_child2, 2);
3499
+ root.setDirection(YogaDirection.LTR);
3500
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3501
+
3502
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3503
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3504
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3505
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3506
+
3507
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3508
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3509
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3510
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3511
+
3512
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3513
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3514
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3515
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3516
+
3517
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3518
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3519
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3520
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3521
+
3522
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3523
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3524
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3525
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3526
+
3527
+ root.setDirection(YogaDirection.RTL);
3528
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3529
+
3530
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3531
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3532
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3533
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3534
+
3535
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3536
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3537
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3538
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3539
+
3540
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3541
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3542
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3543
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3544
+
3545
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3546
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3547
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3548
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3549
+
3550
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3551
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3552
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3553
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3554
+ }
3555
+
3556
+ @Test
3557
+ public void test_flex_direction_row_reverse_inner_padding_left() {
3558
+ YogaConfig config = YogaConfigFactory.create();
3559
+
3560
+ final YogaNode root = createNode(config);
3561
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3562
+ root.setHeight(100f);
3563
+ root.setWidth(100f);
3564
+
3565
+ final YogaNode root_child0 = createNode(config);
3566
+ root_child0.setHeight(100f);
3567
+ root_child0.setWidth(100f);
3568
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3569
+ root.addChildAt(root_child0, 0);
3570
+
3571
+ final YogaNode root_child0_child0 = createNode(config);
3572
+ root_child0_child0.setWidth(10f);
3573
+ root_child0_child0.setHeight(10f);
3574
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3575
+ root_child0_child0.setPadding(YogaEdge.LEFT, 10);
3576
+ root_child0.addChildAt(root_child0_child0, 0);
3577
+
3578
+ final YogaNode root_child0_child1 = createNode(config);
3579
+ root_child0_child1.setWidth(10f);
3580
+ root_child0.addChildAt(root_child0_child1, 1);
3581
+
3582
+ final YogaNode root_child0_child2 = createNode(config);
3583
+ root_child0_child2.setWidth(10f);
3584
+ root_child0.addChildAt(root_child0_child2, 2);
3585
+ root.setDirection(YogaDirection.LTR);
3586
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3587
+
3588
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3589
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3590
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3591
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3592
+
3593
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3594
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3595
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3596
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3597
+
3598
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3599
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3600
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3601
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3602
+
3603
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3604
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3605
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3606
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3607
+
3608
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3609
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3610
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3611
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3612
+
3613
+ root.setDirection(YogaDirection.RTL);
3614
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3615
+
3616
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3617
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3618
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3619
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3620
+
3621
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3622
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3623
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3624
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3625
+
3626
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3627
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3628
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3629
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3630
+
3631
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3632
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3633
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3634
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3635
+
3636
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3637
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3638
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3639
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3640
+ }
3641
+
3642
+ @Test
3643
+ public void test_flex_direction_row_reverse_inner_padding_right() {
3644
+ YogaConfig config = YogaConfigFactory.create();
3645
+
3646
+ final YogaNode root = createNode(config);
3647
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3648
+ root.setHeight(100f);
3649
+ root.setWidth(100f);
3650
+
3651
+ final YogaNode root_child0 = createNode(config);
3652
+ root_child0.setHeight(100f);
3653
+ root_child0.setWidth(100f);
3654
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3655
+ root.addChildAt(root_child0, 0);
3656
+
3657
+ final YogaNode root_child0_child0 = createNode(config);
3658
+ root_child0_child0.setWidth(10f);
3659
+ root_child0_child0.setHeight(10f);
3660
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3661
+ root_child0_child0.setPadding(YogaEdge.RIGHT, 10);
3662
+ root_child0.addChildAt(root_child0_child0, 0);
3663
+
3664
+ final YogaNode root_child0_child1 = createNode(config);
3665
+ root_child0_child1.setWidth(10f);
3666
+ root_child0.addChildAt(root_child0_child1, 1);
3667
+
3668
+ final YogaNode root_child0_child2 = createNode(config);
3669
+ root_child0_child2.setWidth(10f);
3670
+ root_child0.addChildAt(root_child0_child2, 2);
3671
+ root.setDirection(YogaDirection.LTR);
3672
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3673
+
3674
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3675
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3676
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3677
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3678
+
3679
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3680
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3681
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3682
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3683
+
3684
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3685
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3686
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3687
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3688
+
3689
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3690
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3691
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3692
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3693
+
3694
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3695
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3696
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3697
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3698
+
3699
+ root.setDirection(YogaDirection.RTL);
3700
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3701
+
3702
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3703
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3704
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3705
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3706
+
3707
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3708
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3709
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3710
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3711
+
3712
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3713
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3714
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3715
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3716
+
3717
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3718
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3719
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3720
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3721
+
3722
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3723
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3724
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3725
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3726
+ }
3727
+
3728
+ @Test
3729
+ public void test_flex_direction_col_reverse_inner_padding_top() {
3730
+ YogaConfig config = YogaConfigFactory.create();
3731
+
3732
+ final YogaNode root = createNode(config);
3733
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3734
+ root.setHeight(100f);
3735
+ root.setWidth(100f);
3736
+
3737
+ final YogaNode root_child0 = createNode(config);
3738
+ root_child0.setHeight(100f);
3739
+ root_child0.setWidth(100f);
3740
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
3741
+ root.addChildAt(root_child0, 0);
3742
+
3743
+ final YogaNode root_child0_child0 = createNode(config);
3744
+ root_child0_child0.setWidth(10f);
3745
+ root_child0_child0.setHeight(10f);
3746
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3747
+ root_child0_child0.setPadding(YogaEdge.TOP, 10);
3748
+ root_child0.addChildAt(root_child0_child0, 0);
3749
+
3750
+ final YogaNode root_child0_child1 = createNode(config);
3751
+ root_child0_child1.setWidth(10f);
3752
+ root_child0.addChildAt(root_child0_child1, 1);
3753
+
3754
+ final YogaNode root_child0_child2 = createNode(config);
3755
+ root_child0_child2.setWidth(10f);
3756
+ root_child0.addChildAt(root_child0_child2, 2);
3757
+ root.setDirection(YogaDirection.LTR);
3758
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3759
+
3760
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3761
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3762
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3763
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3764
+
3765
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3766
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3767
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3768
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3769
+
3770
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3771
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3772
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3773
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3774
+
3775
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3776
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3777
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3778
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3779
+
3780
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
3781
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3782
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3783
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3784
+
3785
+ root.setDirection(YogaDirection.RTL);
3786
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3787
+
3788
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3789
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3790
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3791
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3792
+
3793
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3794
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3795
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3796
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3797
+
3798
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3799
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3800
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3801
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3802
+
3803
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3804
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3805
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3806
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3807
+
3808
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
3809
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3810
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3811
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3812
+ }
3813
+
3814
+ @Test
3815
+ public void test_flex_direction_col_reverse_inner_padding_bottom() {
3816
+ YogaConfig config = YogaConfigFactory.create();
3817
+
3818
+ final YogaNode root = createNode(config);
3819
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3820
+ root.setHeight(100f);
3821
+ root.setWidth(100f);
3822
+
3823
+ final YogaNode root_child0 = createNode(config);
3824
+ root_child0.setHeight(100f);
3825
+ root_child0.setWidth(100f);
3826
+ root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
3827
+ root.addChildAt(root_child0, 0);
3828
+
3829
+ final YogaNode root_child0_child0 = createNode(config);
3830
+ root_child0_child0.setWidth(10f);
3831
+ root_child0_child0.setHeight(10f);
3832
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3833
+ root_child0_child0.setPadding(YogaEdge.BOTTOM, 10);
3834
+ root_child0.addChildAt(root_child0_child0, 0);
3835
+
3836
+ final YogaNode root_child0_child1 = createNode(config);
3837
+ root_child0_child1.setWidth(10f);
3838
+ root_child0.addChildAt(root_child0_child1, 1);
3839
+
3840
+ final YogaNode root_child0_child2 = createNode(config);
3841
+ root_child0_child2.setWidth(10f);
3842
+ root_child0.addChildAt(root_child0_child2, 2);
3843
+ root.setDirection(YogaDirection.LTR);
3844
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3845
+
3846
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3847
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3848
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3849
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3850
+
3851
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3852
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3853
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3854
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3855
+
3856
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3857
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3858
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3859
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3860
+
3861
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3862
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3863
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3864
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3865
+
3866
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
3867
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3868
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3869
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3870
+
3871
+ root.setDirection(YogaDirection.RTL);
3872
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3873
+
3874
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3875
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3876
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3877
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3878
+
3879
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3880
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3881
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3882
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3883
+
3884
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3885
+ assertEquals(90f, root_child0_child0.getLayoutY(), 0.0f);
3886
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3887
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3888
+
3889
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3890
+ assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
3891
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3892
+ assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
3893
+
3894
+ assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
3895
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
3896
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3897
+ assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
3898
+ }
3899
+
3900
+ @Test
3901
+ public void test_flex_direction_row_reverse_inner_padding_start() {
3902
+ YogaConfig config = YogaConfigFactory.create();
3903
+
3904
+ final YogaNode root = createNode(config);
3905
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3906
+ root.setHeight(100f);
3907
+ root.setWidth(100f);
3908
+
3909
+ final YogaNode root_child0 = createNode(config);
3910
+ root_child0.setHeight(100f);
3911
+ root_child0.setWidth(100f);
3912
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3913
+ root.addChildAt(root_child0, 0);
3914
+
3915
+ final YogaNode root_child0_child0 = createNode(config);
3916
+ root_child0_child0.setWidth(10f);
3917
+ root_child0_child0.setHeight(10f);
3918
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
3919
+ root_child0_child0.setPadding(YogaEdge.START, 10);
3920
+ root_child0.addChildAt(root_child0_child0, 0);
3921
+
3922
+ final YogaNode root_child0_child1 = createNode(config);
3923
+ root_child0_child1.setWidth(10f);
3924
+ root_child0.addChildAt(root_child0_child1, 1);
3925
+
3926
+ final YogaNode root_child0_child2 = createNode(config);
3927
+ root_child0_child2.setWidth(10f);
3928
+ root_child0.addChildAt(root_child0_child2, 2);
3929
+ root.setDirection(YogaDirection.LTR);
3930
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3931
+
3932
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3933
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3934
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3935
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3936
+
3937
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3938
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3939
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3940
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3941
+
3942
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
3943
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3944
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3945
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3946
+
3947
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
3948
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3949
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3950
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3951
+
3952
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
3953
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3954
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3955
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3956
+
3957
+ root.setDirection(YogaDirection.RTL);
3958
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
3959
+
3960
+ assertEquals(0f, root.getLayoutX(), 0.0f);
3961
+ assertEquals(0f, root.getLayoutY(), 0.0f);
3962
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
3963
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
3964
+
3965
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
3966
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
3967
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
3968
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
3969
+
3970
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
3971
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
3972
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
3973
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
3974
+
3975
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
3976
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
3977
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
3978
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
3979
+
3980
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
3981
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
3982
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
3983
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
3984
+ }
3985
+
3986
+ @Test
3987
+ public void test_flex_direction_row_reverse_inner_padding_end() {
3988
+ YogaConfig config = YogaConfigFactory.create();
3989
+
3990
+ final YogaNode root = createNode(config);
3991
+ root.setPositionType(YogaPositionType.ABSOLUTE);
3992
+ root.setHeight(100f);
3993
+ root.setWidth(100f);
3994
+
3995
+ final YogaNode root_child0 = createNode(config);
3996
+ root_child0.setHeight(100f);
3997
+ root_child0.setWidth(100f);
3998
+ root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
3999
+ root.addChildAt(root_child0, 0);
4000
+
4001
+ final YogaNode root_child0_child0 = createNode(config);
4002
+ root_child0_child0.setWidth(10f);
4003
+ root_child0_child0.setHeight(10f);
4004
+ root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
4005
+ root_child0_child0.setPadding(YogaEdge.END, 10);
4006
+ root_child0.addChildAt(root_child0_child0, 0);
4007
+
4008
+ final YogaNode root_child0_child1 = createNode(config);
4009
+ root_child0_child1.setWidth(10f);
4010
+ root_child0.addChildAt(root_child0_child1, 1);
4011
+
4012
+ final YogaNode root_child0_child2 = createNode(config);
4013
+ root_child0_child2.setWidth(10f);
4014
+ root_child0.addChildAt(root_child0_child2, 2);
4015
+ root.setDirection(YogaDirection.LTR);
4016
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
4017
+
4018
+ assertEquals(0f, root.getLayoutX(), 0.0f);
4019
+ assertEquals(0f, root.getLayoutY(), 0.0f);
4020
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
4021
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
4022
+
4023
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
4024
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
4025
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
4026
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
4027
+
4028
+ assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
4029
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
4030
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
4031
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
4032
+
4033
+ assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
4034
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
4035
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
4036
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
4037
+
4038
+ assertEquals(80f, root_child0_child2.getLayoutX(), 0.0f);
4039
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
4040
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
4041
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
4042
+
4043
+ root.setDirection(YogaDirection.RTL);
4044
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
4045
+
4046
+ assertEquals(0f, root.getLayoutX(), 0.0f);
4047
+ assertEquals(0f, root.getLayoutY(), 0.0f);
4048
+ assertEquals(100f, root.getLayoutWidth(), 0.0f);
4049
+ assertEquals(100f, root.getLayoutHeight(), 0.0f);
4050
+
4051
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
4052
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
4053
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
4054
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
4055
+
4056
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
4057
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
4058
+ assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
4059
+ assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
4060
+
4061
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
4062
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
4063
+ assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
4064
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
4065
+
4066
+ assertEquals(10f, root_child0_child2.getLayoutX(), 0.0f);
4067
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
4068
+ assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
4069
+ assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
4070
+ }
4071
+
4072
+ @Test
4073
+ public void test_flex_direction_alternating_with_percent() {
4074
+ YogaConfig config = YogaConfigFactory.create();
4075
+
4076
+ final YogaNode root = createNode(config);
4077
+ root.setPositionType(YogaPositionType.ABSOLUTE);
4078
+ root.setHeight(300f);
4079
+ root.setWidth(200f);
4080
+
4081
+ final YogaNode root_child0 = createNode(config);
4082
+ root_child0.setHeightPercent(50f);
4083
+ root_child0.setWidthPercent(50f);
4084
+ root_child0.setPositionPercent(YogaEdge.LEFT, 10f);
4085
+ root_child0.setPositionPercent(YogaEdge.TOP, 10f);
4086
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
4087
+ root.addChildAt(root_child0, 0);
4088
+ root.setDirection(YogaDirection.LTR);
4089
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
4090
+
4091
+ assertEquals(0f, root.getLayoutX(), 0.0f);
4092
+ assertEquals(0f, root.getLayoutY(), 0.0f);
4093
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
4094
+ assertEquals(300f, root.getLayoutHeight(), 0.0f);
4095
+
4096
+ assertEquals(20f, root_child0.getLayoutX(), 0.0f);
4097
+ assertEquals(30f, root_child0.getLayoutY(), 0.0f);
4098
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
4099
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
4100
+
4101
+ root.setDirection(YogaDirection.RTL);
4102
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
4103
+
4104
+ assertEquals(0f, root.getLayoutX(), 0.0f);
4105
+ assertEquals(0f, root.getLayoutY(), 0.0f);
4106
+ assertEquals(200f, root.getLayoutWidth(), 0.0f);
4107
+ assertEquals(300f, root.getLayoutHeight(), 0.0f);
4108
+
4109
+ assertEquals(120f, root_child0.getLayoutX(), 0.0f);
4110
+ assertEquals(30f, root_child0.getLayoutY(), 0.0f);
4111
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
4112
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
4113
+ }
4114
+
4115
+ private YogaNode createNode(YogaConfig config) {
4116
+ return mNodeFactory.create(config);
4117
+ }
4118
+ }