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