@xincli/opentui-core 0.4.6

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 (476) hide show
  1. package/README.md +63 -0
  2. package/dev/keypress-debug-renderer.ts +148 -0
  3. package/dev/keypress-debug.ts +43 -0
  4. package/dev/print-env-vars.ts +32 -0
  5. package/dev/test-tmux-graphics-334.sh +68 -0
  6. package/dev/test-tmux-theme-queries.sh +151 -0
  7. package/dev/thai-debug-test.ts +68 -0
  8. package/dev/theme-mode.ts +290 -0
  9. package/docs/development.md +144 -0
  10. package/package.json +102 -0
  11. package/prebuilt/aarch64-android/libopentui.so +0 -0
  12. package/scripts/build-android.ts +226 -0
  13. package/scripts/build-native-termux.sh +525 -0
  14. package/scripts/build.ts +530 -0
  15. package/scripts/dist-test.ts +312 -0
  16. package/scripts/package-prebuilt.ts +110 -0
  17. package/scripts/publish.ts +60 -0
  18. package/scripts/test-node-hook.mjs +16 -0
  19. package/scripts/test-node.ts +241 -0
  20. package/scripts/vendor-deps.sh +73 -0
  21. package/src/NativeSpanFeed.ts +375 -0
  22. package/src/Renderable.ts +1878 -0
  23. package/src/__snapshots__/buffer.test.ts.snap +28 -0
  24. package/src/animation/Timeline.test.ts +2709 -0
  25. package/src/animation/Timeline.ts +598 -0
  26. package/src/ansi.ts +22 -0
  27. package/src/audio.ts +479 -0
  28. package/src/benchmark/attenuation-benchmark.ts +81 -0
  29. package/src/benchmark/audio-playback-benchmark.ts +344 -0
  30. package/src/benchmark/box-draw-benchmark.ts +1042 -0
  31. package/src/benchmark/colormatrix-benchmark.ts +123 -0
  32. package/src/benchmark/gain-benchmark.ts +80 -0
  33. package/src/benchmark/latest-all-bench-run.json +707 -0
  34. package/src/benchmark/latest-async-bench-run.json +336 -0
  35. package/src/benchmark/latest-default-bench-run.json +657 -0
  36. package/src/benchmark/latest-large-bench-run.json +707 -0
  37. package/src/benchmark/latest-quick-bench-run.json +207 -0
  38. package/src/benchmark/layout-benchmark.ts +2547 -0
  39. package/src/benchmark/markdown-benchmark.ts +1796 -0
  40. package/src/benchmark/native-span-feed-async-benchmark.ts +355 -0
  41. package/src/benchmark/native-span-feed-benchmark.md +56 -0
  42. package/src/benchmark/native-span-feed-benchmark.ts +596 -0
  43. package/src/benchmark/native-span-feed-compare.ts +280 -0
  44. package/src/benchmark/render-traversal-benchmark.ts +928 -0
  45. package/src/benchmark/text-buffer-render-benchmark.ts +874 -0
  46. package/src/benchmark/text-table-benchmark.ts +948 -0
  47. package/src/buffer.test.ts +292 -0
  48. package/src/buffer.ts +564 -0
  49. package/src/console.test.ts +629 -0
  50. package/src/console.ts +1253 -0
  51. package/src/edit-buffer.test.ts +1852 -0
  52. package/src/edit-buffer.ts +417 -0
  53. package/src/editor-view.test.ts +1056 -0
  54. package/src/editor-view.ts +290 -0
  55. package/src/index.ts +25 -0
  56. package/src/lib/KeyHandler.integration.test.ts +292 -0
  57. package/src/lib/KeyHandler.stopPropagation.test.ts +289 -0
  58. package/src/lib/KeyHandler.test.ts +662 -0
  59. package/src/lib/KeyHandler.ts +222 -0
  60. package/src/lib/RGBA.test.ts +60 -0
  61. package/src/lib/RGBA.ts +343 -0
  62. package/src/lib/ascii.font.ts +330 -0
  63. package/src/lib/border.test.ts +83 -0
  64. package/src/lib/border.ts +170 -0
  65. package/src/lib/bunfs.test.ts +27 -0
  66. package/src/lib/bunfs.ts +18 -0
  67. package/src/lib/clipboard.test.ts +63 -0
  68. package/src/lib/clipboard.ts +41 -0
  69. package/src/lib/clock.ts +35 -0
  70. package/src/lib/data-paths.test.ts +133 -0
  71. package/src/lib/data-paths.ts +109 -0
  72. package/src/lib/debounce.ts +106 -0
  73. package/src/lib/detect-links.test.ts +98 -0
  74. package/src/lib/detect-links.ts +56 -0
  75. package/src/lib/env.test.ts +228 -0
  76. package/src/lib/env.ts +209 -0
  77. package/src/lib/extmarks-history.ts +51 -0
  78. package/src/lib/extmarks-multiwidth.test.ts +324 -0
  79. package/src/lib/extmarks.test.ts +3547 -0
  80. package/src/lib/extmarks.ts +861 -0
  81. package/src/lib/fonts/block.json +405 -0
  82. package/src/lib/fonts/grid.json +265 -0
  83. package/src/lib/fonts/huge.json +741 -0
  84. package/src/lib/fonts/pallet.json +314 -0
  85. package/src/lib/fonts/shade.json +591 -0
  86. package/src/lib/fonts/slick.json +321 -0
  87. package/src/lib/fonts/tiny.json +69 -0
  88. package/src/lib/hast-styled-text.ts +59 -0
  89. package/src/lib/index.ts +22 -0
  90. package/src/lib/keybinding.internal.test.ts +342 -0
  91. package/src/lib/keybinding.internal.ts +182 -0
  92. package/src/lib/objects-in-viewport.test.ts +789 -0
  93. package/src/lib/objects-in-viewport.ts +153 -0
  94. package/src/lib/output.capture.ts +58 -0
  95. package/src/lib/parse.keypress-kitty.protocol.test.ts +347 -0
  96. package/src/lib/parse.keypress-kitty.test.ts +712 -0
  97. package/src/lib/parse.keypress-kitty.ts +470 -0
  98. package/src/lib/parse.keypress.test.ts +2020 -0
  99. package/src/lib/parse.keypress.ts +480 -0
  100. package/src/lib/parse.mouse.test.ts +552 -0
  101. package/src/lib/parse.mouse.ts +232 -0
  102. package/src/lib/paste.ts +18 -0
  103. package/src/lib/queue.ts +65 -0
  104. package/src/lib/render-geometry.ts +36 -0
  105. package/src/lib/renderable.validations.test.ts +87 -0
  106. package/src/lib/renderable.validations.ts +83 -0
  107. package/src/lib/scroll-acceleration.ts +98 -0
  108. package/src/lib/selection.ts +261 -0
  109. package/src/lib/singleton.ts +34 -0
  110. package/src/lib/stdin-parser.test.ts +2439 -0
  111. package/src/lib/stdin-parser.ts +2007 -0
  112. package/src/lib/styled-text.ts +178 -0
  113. package/src/lib/terminal-capability-detection.test.ts +226 -0
  114. package/src/lib/terminal-capability-detection.ts +98 -0
  115. package/src/lib/terminal-palette.test.ts +954 -0
  116. package/src/lib/terminal-palette.ts +441 -0
  117. package/src/lib/tree-sitter/assets/README.md +119 -0
  118. package/src/lib/tree-sitter/assets/javascript/highlights.scm +205 -0
  119. package/src/lib/tree-sitter/assets/javascript/tree-sitter-javascript.wasm +0 -0
  120. package/src/lib/tree-sitter/assets/markdown/highlights.scm +150 -0
  121. package/src/lib/tree-sitter/assets/markdown/injections.scm +27 -0
  122. package/src/lib/tree-sitter/assets/markdown/tree-sitter-markdown.wasm +0 -0
  123. package/src/lib/tree-sitter/assets/markdown_inline/highlights.scm +115 -0
  124. package/src/lib/tree-sitter/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
  125. package/src/lib/tree-sitter/assets/typescript/highlights.scm +604 -0
  126. package/src/lib/tree-sitter/assets/typescript/tree-sitter-typescript.wasm +0 -0
  127. package/src/lib/tree-sitter/assets/update.ts +360 -0
  128. package/src/lib/tree-sitter/assets/zig/highlights.scm +284 -0
  129. package/src/lib/tree-sitter/assets/zig/tree-sitter-zig.wasm +0 -0
  130. package/src/lib/tree-sitter/assets.d.ts +9 -0
  131. package/src/lib/tree-sitter/cache.test.ts +291 -0
  132. package/src/lib/tree-sitter/client.test.ts +1434 -0
  133. package/src/lib/tree-sitter/client.ts +847 -0
  134. package/src/lib/tree-sitter/default-parsers.ts +133 -0
  135. package/src/lib/tree-sitter/download-utils.ts +148 -0
  136. package/src/lib/tree-sitter/index.ts +75 -0
  137. package/src/lib/tree-sitter/parser.worker.ts +1098 -0
  138. package/src/lib/tree-sitter/parsers-config.ts +81 -0
  139. package/src/lib/tree-sitter/resolve-ft.test.ts +55 -0
  140. package/src/lib/tree-sitter/resolve-ft.ts +189 -0
  141. package/src/lib/tree-sitter/types.ts +132 -0
  142. package/src/lib/tree-sitter/update-assets.ts +10 -0
  143. package/src/lib/tree-sitter-styled-text.test.ts +1253 -0
  144. package/src/lib/tree-sitter-styled-text.ts +314 -0
  145. package/src/lib/validate-dir-name.ts +55 -0
  146. package/src/lib/yoga.options.test.ts +628 -0
  147. package/src/lib/yoga.options.ts +346 -0
  148. package/src/native-event-worker-repro.test.ts +48 -0
  149. package/src/native-event-worker-repro.worker.ts +9 -0
  150. package/src/native-handle.test.ts +221 -0
  151. package/src/platform/ffi.test.ts +516 -0
  152. package/src/platform/ffi.ts +653 -0
  153. package/src/platform/runtime.test.ts +52 -0
  154. package/src/platform/runtime.ts +121 -0
  155. package/src/platform/test.ts +45 -0
  156. package/src/platform/worker-handler-cleanup.fixture.ts +12 -0
  157. package/src/platform/worker-onmessage-startup.fixture.ts +10 -0
  158. package/src/platform/worker-startup.fixture.ts +9 -0
  159. package/src/platform/worker.node-test.ts +153 -0
  160. package/src/platform/worker.ts +425 -0
  161. package/src/plugins/core-slot.ts +579 -0
  162. package/src/plugins/registry.ts +402 -0
  163. package/src/plugins/types.ts +46 -0
  164. package/src/post/effects.ts +948 -0
  165. package/src/post/filters.ts +512 -0
  166. package/src/post/matrices.ts +288 -0
  167. package/src/renderables/ASCIIFont.ts +219 -0
  168. package/src/renderables/Box.test.ts +474 -0
  169. package/src/renderables/Box.ts +353 -0
  170. package/src/renderables/Code.test.ts +2388 -0
  171. package/src/renderables/Code.ts +555 -0
  172. package/src/renderables/Diff.regression.test.ts +381 -0
  173. package/src/renderables/Diff.test.ts +3212 -0
  174. package/src/renderables/Diff.ts +1278 -0
  175. package/src/renderables/EditBufferRenderable.test.ts +288 -0
  176. package/src/renderables/EditBufferRenderable.ts +1152 -0
  177. package/src/renderables/FrameBuffer.ts +47 -0
  178. package/src/renderables/Input.test.ts +1310 -0
  179. package/src/renderables/Input.ts +273 -0
  180. package/src/renderables/LineNumberRenderable.ts +725 -0
  181. package/src/renderables/Markdown.ts +2144 -0
  182. package/src/renderables/ScrollBar.ts +423 -0
  183. package/src/renderables/ScrollBox.ts +903 -0
  184. package/src/renderables/Select.test.ts +1134 -0
  185. package/src/renderables/Select.ts +535 -0
  186. package/src/renderables/Slider.test.ts +456 -0
  187. package/src/renderables/Slider.ts +342 -0
  188. package/src/renderables/TabSelect.test.ts +238 -0
  189. package/src/renderables/TabSelect.ts +447 -0
  190. package/src/renderables/Text.selection-buffer.test.ts +118 -0
  191. package/src/renderables/Text.test.ts +2662 -0
  192. package/src/renderables/Text.ts +147 -0
  193. package/src/renderables/TextBufferRenderable.ts +504 -0
  194. package/src/renderables/TextNode.test.ts +1137 -0
  195. package/src/renderables/TextNode.ts +379 -0
  196. package/src/renderables/TextTable.test.ts +1411 -0
  197. package/src/renderables/TextTable.ts +1434 -0
  198. package/src/renderables/Textarea.ts +425 -0
  199. package/src/renderables/TimeToFirstDraw.ts +89 -0
  200. package/src/renderables/__snapshots__/Code.test.ts.snap +13 -0
  201. package/src/renderables/__snapshots__/Diff.test.ts.snap +785 -0
  202. package/src/renderables/__snapshots__/Text.test.ts.snap +421 -0
  203. package/src/renderables/__snapshots__/TextTable.test.ts.snap +215 -0
  204. package/src/renderables/__tests__/Code.test.ts +55 -0
  205. package/src/renderables/__tests__/LineNumberRenderable.scrollbox-simple.test.ts +144 -0
  206. package/src/renderables/__tests__/LineNumberRenderable.scrollbox.test.ts +827 -0
  207. package/src/renderables/__tests__/LineNumberRenderable.test.ts +1906 -0
  208. package/src/renderables/__tests__/LineNumberRenderable.wrapping.test.ts +85 -0
  209. package/src/renderables/__tests__/Markdown.code-colors.test.ts +288 -0
  210. package/src/renderables/__tests__/Markdown.test.ts +4175 -0
  211. package/src/renderables/__tests__/MultiRenderable.selection.test.ts +87 -0
  212. package/src/renderables/__tests__/Textarea.buffer.test.ts +683 -0
  213. package/src/renderables/__tests__/Textarea.destroyed-events.test.ts +675 -0
  214. package/src/renderables/__tests__/Textarea.editing.test.ts +2120 -0
  215. package/src/renderables/__tests__/Textarea.error-handling.test.ts +35 -0
  216. package/src/renderables/__tests__/Textarea.events.test.ts +738 -0
  217. package/src/renderables/__tests__/Textarea.highlights.test.ts +590 -0
  218. package/src/renderables/__tests__/Textarea.keybinding.test.ts +3275 -0
  219. package/src/renderables/__tests__/Textarea.paste.test.ts +357 -0
  220. package/src/renderables/__tests__/Textarea.rendering.test.ts +1927 -0
  221. package/src/renderables/__tests__/Textarea.scroll.test.ts +733 -0
  222. package/src/renderables/__tests__/Textarea.selection.test.ts +1589 -0
  223. package/src/renderables/__tests__/Textarea.stress.test.ts +670 -0
  224. package/src/renderables/__tests__/Textarea.undo-redo.test.ts +383 -0
  225. package/src/renderables/__tests__/Textarea.visual-lines.test.ts +310 -0
  226. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.code.test.ts.snap +221 -0
  227. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox-simple.test.ts.snap +89 -0
  228. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox.test.ts.snap +457 -0
  229. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.test.ts.snap +158 -0
  230. package/src/renderables/__tests__/__snapshots__/Textarea.rendering.test.ts.snap +387 -0
  231. package/src/renderables/__tests__/markdown-parser.test.ts +241 -0
  232. package/src/renderables/__tests__/renderable-test-utils.ts +60 -0
  233. package/src/renderables/composition/README.md +8 -0
  234. package/src/renderables/composition/VRenderable.ts +32 -0
  235. package/src/renderables/composition/constructs.ts +127 -0
  236. package/src/renderables/composition/vnode.ts +277 -0
  237. package/src/renderables/index.ts +23 -0
  238. package/src/renderables/markdown-parser.ts +79 -0
  239. package/src/renderer-theme-mode.ts +199 -0
  240. package/src/renderer.ts +4975 -0
  241. package/src/runtime-plugin-support-configure.ts +63 -0
  242. package/src/runtime-plugin-support.ts +13 -0
  243. package/src/runtime-plugin.ts +626 -0
  244. package/src/specs/terminal-startup.md +64 -0
  245. package/src/syntax-style.test.ts +841 -0
  246. package/src/syntax-style.ts +274 -0
  247. package/src/testing/README.md +219 -0
  248. package/src/testing/bun-test-node.ts +880 -0
  249. package/src/testing/capture-spans.test.ts +216 -0
  250. package/src/testing/integration.test.ts +276 -0
  251. package/src/testing/manual-clock.ts +117 -0
  252. package/src/testing/mock-keys.test.ts +1378 -0
  253. package/src/testing/mock-keys.ts +457 -0
  254. package/src/testing/mock-mouse.test.ts +218 -0
  255. package/src/testing/mock-mouse.ts +247 -0
  256. package/src/testing/mock-tree-sitter-client.ts +81 -0
  257. package/src/testing/spy.ts +13 -0
  258. package/src/testing/terminal-capabilities.ts +47 -0
  259. package/src/testing/test-recorder.test.ts +410 -0
  260. package/src/testing/test-recorder.ts +133 -0
  261. package/src/testing/test-renderer.ts +375 -0
  262. package/src/testing/test-renderer.wait.test.ts +278 -0
  263. package/src/testing/test-streams.ts +31 -0
  264. package/src/testing.ts +9 -0
  265. package/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap +481 -0
  266. package/src/tests/__snapshots__/renderable.snapshot.test.ts.snap +19 -0
  267. package/src/tests/__snapshots__/scrollbox.test.ts.snap +29 -0
  268. package/src/tests/absolute-positioning.snapshot.test.ts +638 -0
  269. package/src/tests/allocator-stats.test.ts +53 -0
  270. package/src/tests/audio.test.ts +303 -0
  271. package/src/tests/destroy-during-render.test.ts +200 -0
  272. package/src/tests/destroy-on-exit.fixture.ts +36 -0
  273. package/src/tests/destroy-on-exit.test.ts +62 -0
  274. package/src/tests/ffi-borrowed-pointer-callsites.test.ts +153 -0
  275. package/src/tests/hover-cursor.test.ts +98 -0
  276. package/src/tests/native-backed-measurement-lifecycle.test.ts +133 -0
  277. package/src/tests/native-backed-measurement-parity.test.ts +322 -0
  278. package/src/tests/native-span-feed-async.test.ts +173 -0
  279. package/src/tests/native-span-feed-close.test.ts +120 -0
  280. package/src/tests/native-span-feed-coverage.test.ts +227 -0
  281. package/src/tests/native-span-feed-edge-cases.test.ts +384 -0
  282. package/src/tests/native-span-feed-use-after-free.test.ts +45 -0
  283. package/src/tests/opacity.test.ts +123 -0
  284. package/src/tests/renderable.snapshot.test.ts +524 -0
  285. package/src/tests/renderable.test.ts +1851 -0
  286. package/src/tests/renderer.clock.test.ts +270 -0
  287. package/src/tests/renderer.console-startup.test.ts +2151 -0
  288. package/src/tests/renderer.control.test.ts +458 -0
  289. package/src/tests/renderer.core-slot-binding.test.ts +962 -0
  290. package/src/tests/renderer.cursor.test.ts +26 -0
  291. package/src/tests/renderer.custom-stdout.test.ts +1112 -0
  292. package/src/tests/renderer.destroy-during-render.test.ts +147 -0
  293. package/src/tests/renderer.focus-restore.test.ts +257 -0
  294. package/src/tests/renderer.focus.test.ts +329 -0
  295. package/src/tests/renderer.idle.test.ts +219 -0
  296. package/src/tests/renderer.input.test.ts +2615 -0
  297. package/src/tests/renderer.kitty-flags.test.ts +195 -0
  298. package/src/tests/renderer.lifecycle.test.ts +34 -0
  299. package/src/tests/renderer.mouse.test.ts +1315 -0
  300. package/src/tests/renderer.notifications.test.ts +27 -0
  301. package/src/tests/renderer.palette.test.ts +1199 -0
  302. package/src/tests/renderer.remote.test.ts +247 -0
  303. package/src/tests/renderer.render-stats.test.ts +146 -0
  304. package/src/tests/renderer.scrollback-surface.test.ts +474 -0
  305. package/src/tests/renderer.selection.test.ts +138 -0
  306. package/src/tests/renderer.slot-registry.test.ts +684 -0
  307. package/src/tests/renderer.tracker.test.ts +202 -0
  308. package/src/tests/renderer.useMouse.test.ts +83 -0
  309. package/src/tests/runtime-plugin-node-modules-cycle.fixture.ts +76 -0
  310. package/src/tests/runtime-plugin-node-modules-import-like-string.fixture.ts +48 -0
  311. package/src/tests/runtime-plugin-node-modules-mjs.fixture.ts +43 -0
  312. package/src/tests/runtime-plugin-node-modules-no-bare-rewrite.fixture.ts +67 -0
  313. package/src/tests/runtime-plugin-node-modules-package-type-cache.fixture.ts +72 -0
  314. package/src/tests/runtime-plugin-node-modules-runtime-specifier.fixture.ts +44 -0
  315. package/src/tests/runtime-plugin-node-modules-scoped-package-bare-rewrite.fixture.ts +85 -0
  316. package/src/tests/runtime-plugin-path-alias.fixture.ts +43 -0
  317. package/src/tests/runtime-plugin-resolve-roots.fixture.ts +65 -0
  318. package/src/tests/runtime-plugin-support-configure.fixture.ts +31 -0
  319. package/src/tests/runtime-plugin-support-late-addition.fixture.ts +17 -0
  320. package/src/tests/runtime-plugin-support.fixture.ts +11 -0
  321. package/src/tests/runtime-plugin-support.test.ts +54 -0
  322. package/src/tests/runtime-plugin-windows-file-url.fixture.ts +30 -0
  323. package/src/tests/runtime-plugin.fixture.ts +40 -0
  324. package/src/tests/runtime-plugin.test.ts +369 -0
  325. package/src/tests/scrollbox-culling-bug.test.ts +114 -0
  326. package/src/tests/scrollbox-hitgrid-resize.test.ts +136 -0
  327. package/src/tests/scrollbox-hitgrid.test.ts +909 -0
  328. package/src/tests/scrollbox.test.ts +1895 -0
  329. package/src/tests/wrap-resize-perf.test.ts +276 -0
  330. package/src/tests/yoga-api-coverage.test.ts +409 -0
  331. package/src/tests/yoga-callback-stress.test.ts +122 -0
  332. package/src/tests/yoga-ffi.test.ts +117 -0
  333. package/src/tests/yoga-setters.test.ts +921 -0
  334. package/src/tests/yoga-upstream/YGAlignBaselineTest.test.ts +124 -0
  335. package/src/tests/yoga-upstream/YGComputedBorderTest.test.ts +27 -0
  336. package/src/tests/yoga-upstream/YGComputedMarginTest.test.ts +27 -0
  337. package/src/tests/yoga-upstream/YGComputedPaddingTest.test.ts +27 -0
  338. package/src/tests/yoga-upstream/YGDirtiedTest.test.ts +157 -0
  339. package/src/tests/yoga-upstream/YGErrataTest.test.ts +40 -0
  340. package/src/tests/yoga-upstream/YGFlexBasisAuto.test.ts +23 -0
  341. package/src/tests/yoga-upstream/YGHasNewLayout.test.ts +81 -0
  342. package/src/tests/yoga-upstream/YGMeasureCacheTest.test.ts +31 -0
  343. package/src/tests/yoga-upstream/YGMeasureTest.test.ts +70 -0
  344. package/src/tests/yoga-upstream/generated/YGAbsolutePositionTest.test.ts +1864 -0
  345. package/src/tests/yoga-upstream/generated/YGAlignContentTest.test.ts +5829 -0
  346. package/src/tests/yoga-upstream/generated/YGAlignItemsTest.test.ts +2444 -0
  347. package/src/tests/yoga-upstream/generated/YGAlignSelfTest.test.ts +293 -0
  348. package/src/tests/yoga-upstream/generated/YGAndroidNewsFeed.test.ts +315 -0
  349. package/src/tests/yoga-upstream/generated/YGAspectRatioTest.test.ts +231 -0
  350. package/src/tests/yoga-upstream/generated/YGAutoTest.test.ts +347 -0
  351. package/src/tests/yoga-upstream/generated/YGBorderTest.test.ts +256 -0
  352. package/src/tests/yoga-upstream/generated/YGBoxSizingTest.test.ts +2747 -0
  353. package/src/tests/yoga-upstream/generated/YGDimensionTest.test.ts +129 -0
  354. package/src/tests/yoga-upstream/generated/YGDisplayContentsTest.test.ts +109 -0
  355. package/src/tests/yoga-upstream/generated/YGDisplayTest.test.ts +1097 -0
  356. package/src/tests/yoga-upstream/generated/YGFlexDirectionTest.test.ts +4562 -0
  357. package/src/tests/yoga-upstream/generated/YGFlexTest.test.ts +677 -0
  358. package/src/tests/yoga-upstream/generated/YGFlexWrapTest.test.ts +2071 -0
  359. package/src/tests/yoga-upstream/generated/YGGapTest.test.ts +3303 -0
  360. package/src/tests/yoga-upstream/generated/YGIntrinsicSizeTest.test.ts +582 -0
  361. package/src/tests/yoga-upstream/generated/YGJustifyContentTest.test.ts +2150 -0
  362. package/src/tests/yoga-upstream/generated/YGMarginTest.test.ts +1963 -0
  363. package/src/tests/yoga-upstream/generated/YGMinMaxDimensionTest.test.ts +1446 -0
  364. package/src/tests/yoga-upstream/generated/YGPaddingTest.test.ts +354 -0
  365. package/src/tests/yoga-upstream/generated/YGPercentageTest.test.ts +1760 -0
  366. package/src/tests/yoga-upstream/generated/YGRoundingTest.test.ts +1161 -0
  367. package/src/tests/yoga-upstream/generated/YGSizeOverflowTest.test.ts +207 -0
  368. package/src/tests/yoga-upstream/generated/YGStaticPositionTest.test.ts +6338 -0
  369. package/src/tests/yoga-upstream/tools/MeasureCounter.ts +54 -0
  370. package/src/tests/yoga-upstream/tools/utils.ts +81 -0
  371. package/src/text-buffer-view.test.ts +722 -0
  372. package/src/text-buffer-view.ts +193 -0
  373. package/src/text-buffer.test.ts +512 -0
  374. package/src/text-buffer.ts +250 -0
  375. package/src/types.ts +199 -0
  376. package/src/utils.ts +88 -0
  377. package/src/yoga.ts +1146 -0
  378. package/src/zig/ansi.zig +502 -0
  379. package/src/zig/audio.zig +1206 -0
  380. package/src/zig/bench/README.md +50 -0
  381. package/src/zig/bench/buffer-color-blending_bench.zig +350 -0
  382. package/src/zig/bench/buffer-draw-box_bench.zig +786 -0
  383. package/src/zig/bench/buffer-draw-text-buffer_bench.zig +894 -0
  384. package/src/zig/bench/edit-buffer_bench.zig +476 -0
  385. package/src/zig/bench/editor-view_bench.zig +169 -0
  386. package/src/zig/bench/native-span-feed_bench.zig +107 -0
  387. package/src/zig/bench/rope-markers_bench.zig +713 -0
  388. package/src/zig/bench/rope_bench.zig +514 -0
  389. package/src/zig/bench/styled-text_bench.zig +476 -0
  390. package/src/zig/bench/text-buffer-coords_bench.zig +362 -0
  391. package/src/zig/bench/text-buffer-view_bench.zig +459 -0
  392. package/src/zig/bench/text-chunk-graphemes_bench.zig +272 -0
  393. package/src/zig/bench/utf8_bench.zig +799 -0
  394. package/src/zig/bench-utils.zig +431 -0
  395. package/src/zig/bench.zig +223 -0
  396. package/src/zig/buffer-methods.zig +215 -0
  397. package/src/zig/buffer.zig +2515 -0
  398. package/src/zig/build.zig +700 -0
  399. package/src/zig/build.zig.zon +19 -0
  400. package/src/zig/edit-buffer.zig +900 -0
  401. package/src/zig/editor-view.zig +812 -0
  402. package/src/zig/event-bus.zig +28 -0
  403. package/src/zig/event-emitter.zig +65 -0
  404. package/src/zig/file-logger.zig +92 -0
  405. package/src/zig/grapheme.zig +838 -0
  406. package/src/zig/handles.zig +267 -0
  407. package/src/zig/lib.zig +2813 -0
  408. package/src/zig/link.zig +349 -0
  409. package/src/zig/logger.zig +43 -0
  410. package/src/zig/mem-registry.zig +126 -0
  411. package/src/zig/miniaudio_shim.c +21 -0
  412. package/src/zig/native-renderable.zig +112 -0
  413. package/src/zig/native-span-feed-bench-lib.zig +7 -0
  414. package/src/zig/native-span-feed.zig +747 -0
  415. package/src/zig/renderer-output.zig +677 -0
  416. package/src/zig/renderer.zig +2106 -0
  417. package/src/zig/rope.zig +1220 -0
  418. package/src/zig/split-scrollback.zig +88 -0
  419. package/src/zig/syntax-style.zig +174 -0
  420. package/src/zig/terminal.zig +1652 -0
  421. package/src/zig/test.zig +82 -0
  422. package/src/zig/tests/README.md +18 -0
  423. package/src/zig/tests/ansi_test.zig +18 -0
  424. package/src/zig/tests/audio_test.zig +439 -0
  425. package/src/zig/tests/buffer-methods_test.zig +1111 -0
  426. package/src/zig/tests/buffer_test.zig +2926 -0
  427. package/src/zig/tests/edit-buffer-history_test.zig +299 -0
  428. package/src/zig/tests/edit-buffer_test.zig +1688 -0
  429. package/src/zig/tests/editor-view_test.zig +3454 -0
  430. package/src/zig/tests/event-emitter_test.zig +249 -0
  431. package/src/zig/tests/grapheme_test.zig +1329 -0
  432. package/src/zig/tests/handles_test.zig +123 -0
  433. package/src/zig/tests/link_test.zig +220 -0
  434. package/src/zig/tests/mem-registry_test.zig +473 -0
  435. package/src/zig/tests/memory_leak_regression_test.zig +234 -0
  436. package/src/zig/tests/native-renderable_test.zig +16 -0
  437. package/src/zig/tests/native-span-feed_test.zig +1266 -0
  438. package/src/zig/tests/renderer_test.zig +2604 -0
  439. package/src/zig/tests/rope-nested_test.zig +712 -0
  440. package/src/zig/tests/rope_fuzz_test.zig +238 -0
  441. package/src/zig/tests/rope_test.zig +2362 -0
  442. package/src/zig/tests/segment-merge.test.zig +148 -0
  443. package/src/zig/tests/split-scrollback_test.zig +70 -0
  444. package/src/zig/tests/syntax-style_test.zig +558 -0
  445. package/src/zig/tests/terminal_test.zig +1489 -0
  446. package/src/zig/tests/test-renderer.zig +126 -0
  447. package/src/zig/tests/text-buffer-drawing_test.zig +3291 -0
  448. package/src/zig/tests/text-buffer-highlights_test.zig +706 -0
  449. package/src/zig/tests/text-buffer-iterators_test.zig +776 -0
  450. package/src/zig/tests/text-buffer-segment_test.zig +320 -0
  451. package/src/zig/tests/text-buffer-selection_test.zig +1056 -0
  452. package/src/zig/tests/text-buffer-selection_viewport_test.zig +358 -0
  453. package/src/zig/tests/text-buffer-view_test.zig +3672 -0
  454. package/src/zig/tests/text-buffer_test.zig +2191 -0
  455. package/src/zig/tests/unicode-width-map.zon +3909 -0
  456. package/src/zig/tests/utf8_no_zwj_test.zig +260 -0
  457. package/src/zig/tests/utf8_test.zig +4060 -0
  458. package/src/zig/tests/utf8_wcwidth_cursor_test.zig +267 -0
  459. package/src/zig/tests/utf8_wcwidth_test.zig +357 -0
  460. package/src/zig/tests/word-wrap-editing_test.zig +498 -0
  461. package/src/zig/tests/wrap-cache-perf_test.zig +113 -0
  462. package/src/zig/tests/yoga_test.zig +65 -0
  463. package/src/zig/text-buffer-iterators.zig +496 -0
  464. package/src/zig/text-buffer-segment.zig +403 -0
  465. package/src/zig/text-buffer-view.zig +1428 -0
  466. package/src/zig/text-buffer.zig +1272 -0
  467. package/src/zig/utf8.zig +1954 -0
  468. package/src/zig/utils.zig +12 -0
  469. package/src/zig/uucode-stub.zig +76 -0
  470. package/src/zig/vendor/miniaudio/miniaudio.h +93468 -0
  471. package/src/zig/yoga.zig +658 -0
  472. package/src/zig-structs.ts +381 -0
  473. package/src/zig.ts +5260 -0
  474. package/tsconfig.build.json +17 -0
  475. package/tsconfig.json +27 -0
  476. package/tsconfig.node-test.json +138 -0
@@ -0,0 +1,4562 @@
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<<285a0c9dd4b646e7b1af77658fc41d99>>
8
+ * generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexDirectionTest.html
9
+ */
10
+
11
+ import { instrinsicSizeMeasureFunc } from "../tools/utils.ts"
12
+ import Yoga from "../../../yoga.js"
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.js"
30
+
31
+ test("flex_direction_column_no_height", () => {
32
+ const config = Yoga.Config.create()
33
+ let root
34
+
35
+ try {
36
+ root = Yoga.Node.create(config)
37
+ root.setPositionType(PositionType.Absolute)
38
+ root.setWidth(100)
39
+
40
+ const root_child0 = Yoga.Node.create(config)
41
+ root_child0.setHeight(10)
42
+ root.insertChild(root_child0, 0)
43
+
44
+ const root_child1 = Yoga.Node.create(config)
45
+ root_child1.setHeight(10)
46
+ root.insertChild(root_child1, 1)
47
+
48
+ const root_child2 = Yoga.Node.create(config)
49
+ root_child2.setHeight(10)
50
+ root.insertChild(root_child2, 2)
51
+ root.calculateLayout(undefined, undefined, Direction.LTR)
52
+
53
+ expect(root.getComputedLeft()).toBe(0)
54
+ expect(root.getComputedTop()).toBe(0)
55
+ expect(root.getComputedWidth()).toBe(100)
56
+ expect(root.getComputedHeight()).toBe(30)
57
+
58
+ expect(root_child0.getComputedLeft()).toBe(0)
59
+ expect(root_child0.getComputedTop()).toBe(0)
60
+ expect(root_child0.getComputedWidth()).toBe(100)
61
+ expect(root_child0.getComputedHeight()).toBe(10)
62
+
63
+ expect(root_child1.getComputedLeft()).toBe(0)
64
+ expect(root_child1.getComputedTop()).toBe(10)
65
+ expect(root_child1.getComputedWidth()).toBe(100)
66
+ expect(root_child1.getComputedHeight()).toBe(10)
67
+
68
+ expect(root_child2.getComputedLeft()).toBe(0)
69
+ expect(root_child2.getComputedTop()).toBe(20)
70
+ expect(root_child2.getComputedWidth()).toBe(100)
71
+ expect(root_child2.getComputedHeight()).toBe(10)
72
+
73
+ root.calculateLayout(undefined, undefined, Direction.RTL)
74
+
75
+ expect(root.getComputedLeft()).toBe(0)
76
+ expect(root.getComputedTop()).toBe(0)
77
+ expect(root.getComputedWidth()).toBe(100)
78
+ expect(root.getComputedHeight()).toBe(30)
79
+
80
+ expect(root_child0.getComputedLeft()).toBe(0)
81
+ expect(root_child0.getComputedTop()).toBe(0)
82
+ expect(root_child0.getComputedWidth()).toBe(100)
83
+ expect(root_child0.getComputedHeight()).toBe(10)
84
+
85
+ expect(root_child1.getComputedLeft()).toBe(0)
86
+ expect(root_child1.getComputedTop()).toBe(10)
87
+ expect(root_child1.getComputedWidth()).toBe(100)
88
+ expect(root_child1.getComputedHeight()).toBe(10)
89
+
90
+ expect(root_child2.getComputedLeft()).toBe(0)
91
+ expect(root_child2.getComputedTop()).toBe(20)
92
+ expect(root_child2.getComputedWidth()).toBe(100)
93
+ expect(root_child2.getComputedHeight()).toBe(10)
94
+ } finally {
95
+ if (typeof root !== "undefined") {
96
+ root.freeRecursive()
97
+ }
98
+
99
+ config.free()
100
+ }
101
+ })
102
+ test("flex_direction_row_no_width", () => {
103
+ const config = Yoga.Config.create()
104
+ let root
105
+
106
+ try {
107
+ root = Yoga.Node.create(config)
108
+ root.setFlexDirection(FlexDirection.Row)
109
+ root.setPositionType(PositionType.Absolute)
110
+ root.setHeight(100)
111
+
112
+ const root_child0 = Yoga.Node.create(config)
113
+ root_child0.setWidth(10)
114
+ root.insertChild(root_child0, 0)
115
+
116
+ const root_child1 = Yoga.Node.create(config)
117
+ root_child1.setWidth(10)
118
+ root.insertChild(root_child1, 1)
119
+
120
+ const root_child2 = Yoga.Node.create(config)
121
+ root_child2.setWidth(10)
122
+ root.insertChild(root_child2, 2)
123
+ root.calculateLayout(undefined, undefined, Direction.LTR)
124
+
125
+ expect(root.getComputedLeft()).toBe(0)
126
+ expect(root.getComputedTop()).toBe(0)
127
+ expect(root.getComputedWidth()).toBe(30)
128
+ expect(root.getComputedHeight()).toBe(100)
129
+
130
+ expect(root_child0.getComputedLeft()).toBe(0)
131
+ expect(root_child0.getComputedTop()).toBe(0)
132
+ expect(root_child0.getComputedWidth()).toBe(10)
133
+ expect(root_child0.getComputedHeight()).toBe(100)
134
+
135
+ expect(root_child1.getComputedLeft()).toBe(10)
136
+ expect(root_child1.getComputedTop()).toBe(0)
137
+ expect(root_child1.getComputedWidth()).toBe(10)
138
+ expect(root_child1.getComputedHeight()).toBe(100)
139
+
140
+ expect(root_child2.getComputedLeft()).toBe(20)
141
+ expect(root_child2.getComputedTop()).toBe(0)
142
+ expect(root_child2.getComputedWidth()).toBe(10)
143
+ expect(root_child2.getComputedHeight()).toBe(100)
144
+
145
+ root.calculateLayout(undefined, undefined, Direction.RTL)
146
+
147
+ expect(root.getComputedLeft()).toBe(0)
148
+ expect(root.getComputedTop()).toBe(0)
149
+ expect(root.getComputedWidth()).toBe(30)
150
+ expect(root.getComputedHeight()).toBe(100)
151
+
152
+ expect(root_child0.getComputedLeft()).toBe(20)
153
+ expect(root_child0.getComputedTop()).toBe(0)
154
+ expect(root_child0.getComputedWidth()).toBe(10)
155
+ expect(root_child0.getComputedHeight()).toBe(100)
156
+
157
+ expect(root_child1.getComputedLeft()).toBe(10)
158
+ expect(root_child1.getComputedTop()).toBe(0)
159
+ expect(root_child1.getComputedWidth()).toBe(10)
160
+ expect(root_child1.getComputedHeight()).toBe(100)
161
+
162
+ expect(root_child2.getComputedLeft()).toBe(0)
163
+ expect(root_child2.getComputedTop()).toBe(0)
164
+ expect(root_child2.getComputedWidth()).toBe(10)
165
+ expect(root_child2.getComputedHeight()).toBe(100)
166
+ } finally {
167
+ if (typeof root !== "undefined") {
168
+ root.freeRecursive()
169
+ }
170
+
171
+ config.free()
172
+ }
173
+ })
174
+ test("flex_direction_column", () => {
175
+ const config = Yoga.Config.create()
176
+ let root
177
+
178
+ try {
179
+ root = Yoga.Node.create(config)
180
+ root.setPositionType(PositionType.Absolute)
181
+ root.setWidth(100)
182
+ root.setHeight(100)
183
+
184
+ const root_child0 = Yoga.Node.create(config)
185
+ root_child0.setHeight(10)
186
+ root.insertChild(root_child0, 0)
187
+
188
+ const root_child1 = Yoga.Node.create(config)
189
+ root_child1.setHeight(10)
190
+ root.insertChild(root_child1, 1)
191
+
192
+ const root_child2 = Yoga.Node.create(config)
193
+ root_child2.setHeight(10)
194
+ root.insertChild(root_child2, 2)
195
+ root.calculateLayout(undefined, undefined, Direction.LTR)
196
+
197
+ expect(root.getComputedLeft()).toBe(0)
198
+ expect(root.getComputedTop()).toBe(0)
199
+ expect(root.getComputedWidth()).toBe(100)
200
+ expect(root.getComputedHeight()).toBe(100)
201
+
202
+ expect(root_child0.getComputedLeft()).toBe(0)
203
+ expect(root_child0.getComputedTop()).toBe(0)
204
+ expect(root_child0.getComputedWidth()).toBe(100)
205
+ expect(root_child0.getComputedHeight()).toBe(10)
206
+
207
+ expect(root_child1.getComputedLeft()).toBe(0)
208
+ expect(root_child1.getComputedTop()).toBe(10)
209
+ expect(root_child1.getComputedWidth()).toBe(100)
210
+ expect(root_child1.getComputedHeight()).toBe(10)
211
+
212
+ expect(root_child2.getComputedLeft()).toBe(0)
213
+ expect(root_child2.getComputedTop()).toBe(20)
214
+ expect(root_child2.getComputedWidth()).toBe(100)
215
+ expect(root_child2.getComputedHeight()).toBe(10)
216
+
217
+ root.calculateLayout(undefined, undefined, Direction.RTL)
218
+
219
+ expect(root.getComputedLeft()).toBe(0)
220
+ expect(root.getComputedTop()).toBe(0)
221
+ expect(root.getComputedWidth()).toBe(100)
222
+ expect(root.getComputedHeight()).toBe(100)
223
+
224
+ expect(root_child0.getComputedLeft()).toBe(0)
225
+ expect(root_child0.getComputedTop()).toBe(0)
226
+ expect(root_child0.getComputedWidth()).toBe(100)
227
+ expect(root_child0.getComputedHeight()).toBe(10)
228
+
229
+ expect(root_child1.getComputedLeft()).toBe(0)
230
+ expect(root_child1.getComputedTop()).toBe(10)
231
+ expect(root_child1.getComputedWidth()).toBe(100)
232
+ expect(root_child1.getComputedHeight()).toBe(10)
233
+
234
+ expect(root_child2.getComputedLeft()).toBe(0)
235
+ expect(root_child2.getComputedTop()).toBe(20)
236
+ expect(root_child2.getComputedWidth()).toBe(100)
237
+ expect(root_child2.getComputedHeight()).toBe(10)
238
+ } finally {
239
+ if (typeof root !== "undefined") {
240
+ root.freeRecursive()
241
+ }
242
+
243
+ config.free()
244
+ }
245
+ })
246
+ test("flex_direction_row", () => {
247
+ const config = Yoga.Config.create()
248
+ let root
249
+
250
+ try {
251
+ root = Yoga.Node.create(config)
252
+ root.setFlexDirection(FlexDirection.Row)
253
+ root.setPositionType(PositionType.Absolute)
254
+ root.setWidth(100)
255
+ root.setHeight(100)
256
+
257
+ const root_child0 = Yoga.Node.create(config)
258
+ root_child0.setWidth(10)
259
+ root.insertChild(root_child0, 0)
260
+
261
+ const root_child1 = Yoga.Node.create(config)
262
+ root_child1.setWidth(10)
263
+ root.insertChild(root_child1, 1)
264
+
265
+ const root_child2 = Yoga.Node.create(config)
266
+ root_child2.setWidth(10)
267
+ root.insertChild(root_child2, 2)
268
+ root.calculateLayout(undefined, undefined, Direction.LTR)
269
+
270
+ expect(root.getComputedLeft()).toBe(0)
271
+ expect(root.getComputedTop()).toBe(0)
272
+ expect(root.getComputedWidth()).toBe(100)
273
+ expect(root.getComputedHeight()).toBe(100)
274
+
275
+ expect(root_child0.getComputedLeft()).toBe(0)
276
+ expect(root_child0.getComputedTop()).toBe(0)
277
+ expect(root_child0.getComputedWidth()).toBe(10)
278
+ expect(root_child0.getComputedHeight()).toBe(100)
279
+
280
+ expect(root_child1.getComputedLeft()).toBe(10)
281
+ expect(root_child1.getComputedTop()).toBe(0)
282
+ expect(root_child1.getComputedWidth()).toBe(10)
283
+ expect(root_child1.getComputedHeight()).toBe(100)
284
+
285
+ expect(root_child2.getComputedLeft()).toBe(20)
286
+ expect(root_child2.getComputedTop()).toBe(0)
287
+ expect(root_child2.getComputedWidth()).toBe(10)
288
+ expect(root_child2.getComputedHeight()).toBe(100)
289
+
290
+ root.calculateLayout(undefined, undefined, Direction.RTL)
291
+
292
+ expect(root.getComputedLeft()).toBe(0)
293
+ expect(root.getComputedTop()).toBe(0)
294
+ expect(root.getComputedWidth()).toBe(100)
295
+ expect(root.getComputedHeight()).toBe(100)
296
+
297
+ expect(root_child0.getComputedLeft()).toBe(90)
298
+ expect(root_child0.getComputedTop()).toBe(0)
299
+ expect(root_child0.getComputedWidth()).toBe(10)
300
+ expect(root_child0.getComputedHeight()).toBe(100)
301
+
302
+ expect(root_child1.getComputedLeft()).toBe(80)
303
+ expect(root_child1.getComputedTop()).toBe(0)
304
+ expect(root_child1.getComputedWidth()).toBe(10)
305
+ expect(root_child1.getComputedHeight()).toBe(100)
306
+
307
+ expect(root_child2.getComputedLeft()).toBe(70)
308
+ expect(root_child2.getComputedTop()).toBe(0)
309
+ expect(root_child2.getComputedWidth()).toBe(10)
310
+ expect(root_child2.getComputedHeight()).toBe(100)
311
+ } finally {
312
+ if (typeof root !== "undefined") {
313
+ root.freeRecursive()
314
+ }
315
+
316
+ config.free()
317
+ }
318
+ })
319
+ test("flex_direction_column_reverse", () => {
320
+ const config = Yoga.Config.create()
321
+ let root
322
+
323
+ try {
324
+ root = Yoga.Node.create(config)
325
+ root.setFlexDirection(FlexDirection.ColumnReverse)
326
+ root.setPositionType(PositionType.Absolute)
327
+ root.setWidth(100)
328
+ root.setHeight(100)
329
+
330
+ const root_child0 = Yoga.Node.create(config)
331
+ root_child0.setHeight(10)
332
+ root.insertChild(root_child0, 0)
333
+
334
+ const root_child1 = Yoga.Node.create(config)
335
+ root_child1.setHeight(10)
336
+ root.insertChild(root_child1, 1)
337
+
338
+ const root_child2 = Yoga.Node.create(config)
339
+ root_child2.setHeight(10)
340
+ root.insertChild(root_child2, 2)
341
+ root.calculateLayout(undefined, undefined, Direction.LTR)
342
+
343
+ expect(root.getComputedLeft()).toBe(0)
344
+ expect(root.getComputedTop()).toBe(0)
345
+ expect(root.getComputedWidth()).toBe(100)
346
+ expect(root.getComputedHeight()).toBe(100)
347
+
348
+ expect(root_child0.getComputedLeft()).toBe(0)
349
+ expect(root_child0.getComputedTop()).toBe(90)
350
+ expect(root_child0.getComputedWidth()).toBe(100)
351
+ expect(root_child0.getComputedHeight()).toBe(10)
352
+
353
+ expect(root_child1.getComputedLeft()).toBe(0)
354
+ expect(root_child1.getComputedTop()).toBe(80)
355
+ expect(root_child1.getComputedWidth()).toBe(100)
356
+ expect(root_child1.getComputedHeight()).toBe(10)
357
+
358
+ expect(root_child2.getComputedLeft()).toBe(0)
359
+ expect(root_child2.getComputedTop()).toBe(70)
360
+ expect(root_child2.getComputedWidth()).toBe(100)
361
+ expect(root_child2.getComputedHeight()).toBe(10)
362
+
363
+ root.calculateLayout(undefined, undefined, Direction.RTL)
364
+
365
+ expect(root.getComputedLeft()).toBe(0)
366
+ expect(root.getComputedTop()).toBe(0)
367
+ expect(root.getComputedWidth()).toBe(100)
368
+ expect(root.getComputedHeight()).toBe(100)
369
+
370
+ expect(root_child0.getComputedLeft()).toBe(0)
371
+ expect(root_child0.getComputedTop()).toBe(90)
372
+ expect(root_child0.getComputedWidth()).toBe(100)
373
+ expect(root_child0.getComputedHeight()).toBe(10)
374
+
375
+ expect(root_child1.getComputedLeft()).toBe(0)
376
+ expect(root_child1.getComputedTop()).toBe(80)
377
+ expect(root_child1.getComputedWidth()).toBe(100)
378
+ expect(root_child1.getComputedHeight()).toBe(10)
379
+
380
+ expect(root_child2.getComputedLeft()).toBe(0)
381
+ expect(root_child2.getComputedTop()).toBe(70)
382
+ expect(root_child2.getComputedWidth()).toBe(100)
383
+ expect(root_child2.getComputedHeight()).toBe(10)
384
+ } finally {
385
+ if (typeof root !== "undefined") {
386
+ root.freeRecursive()
387
+ }
388
+
389
+ config.free()
390
+ }
391
+ })
392
+ test("flex_direction_row_reverse", () => {
393
+ const config = Yoga.Config.create()
394
+ let root
395
+
396
+ try {
397
+ root = Yoga.Node.create(config)
398
+ root.setFlexDirection(FlexDirection.RowReverse)
399
+ root.setPositionType(PositionType.Absolute)
400
+ root.setWidth(100)
401
+ root.setHeight(100)
402
+
403
+ const root_child0 = Yoga.Node.create(config)
404
+ root_child0.setWidth(10)
405
+ root.insertChild(root_child0, 0)
406
+
407
+ const root_child1 = Yoga.Node.create(config)
408
+ root_child1.setWidth(10)
409
+ root.insertChild(root_child1, 1)
410
+
411
+ const root_child2 = Yoga.Node.create(config)
412
+ root_child2.setWidth(10)
413
+ root.insertChild(root_child2, 2)
414
+ root.calculateLayout(undefined, undefined, Direction.LTR)
415
+
416
+ expect(root.getComputedLeft()).toBe(0)
417
+ expect(root.getComputedTop()).toBe(0)
418
+ expect(root.getComputedWidth()).toBe(100)
419
+ expect(root.getComputedHeight()).toBe(100)
420
+
421
+ expect(root_child0.getComputedLeft()).toBe(90)
422
+ expect(root_child0.getComputedTop()).toBe(0)
423
+ expect(root_child0.getComputedWidth()).toBe(10)
424
+ expect(root_child0.getComputedHeight()).toBe(100)
425
+
426
+ expect(root_child1.getComputedLeft()).toBe(80)
427
+ expect(root_child1.getComputedTop()).toBe(0)
428
+ expect(root_child1.getComputedWidth()).toBe(10)
429
+ expect(root_child1.getComputedHeight()).toBe(100)
430
+
431
+ expect(root_child2.getComputedLeft()).toBe(70)
432
+ expect(root_child2.getComputedTop()).toBe(0)
433
+ expect(root_child2.getComputedWidth()).toBe(10)
434
+ expect(root_child2.getComputedHeight()).toBe(100)
435
+
436
+ root.calculateLayout(undefined, undefined, Direction.RTL)
437
+
438
+ expect(root.getComputedLeft()).toBe(0)
439
+ expect(root.getComputedTop()).toBe(0)
440
+ expect(root.getComputedWidth()).toBe(100)
441
+ expect(root.getComputedHeight()).toBe(100)
442
+
443
+ expect(root_child0.getComputedLeft()).toBe(0)
444
+ expect(root_child0.getComputedTop()).toBe(0)
445
+ expect(root_child0.getComputedWidth()).toBe(10)
446
+ expect(root_child0.getComputedHeight()).toBe(100)
447
+
448
+ expect(root_child1.getComputedLeft()).toBe(10)
449
+ expect(root_child1.getComputedTop()).toBe(0)
450
+ expect(root_child1.getComputedWidth()).toBe(10)
451
+ expect(root_child1.getComputedHeight()).toBe(100)
452
+
453
+ expect(root_child2.getComputedLeft()).toBe(20)
454
+ expect(root_child2.getComputedTop()).toBe(0)
455
+ expect(root_child2.getComputedWidth()).toBe(10)
456
+ expect(root_child2.getComputedHeight()).toBe(100)
457
+ } finally {
458
+ if (typeof root !== "undefined") {
459
+ root.freeRecursive()
460
+ }
461
+
462
+ config.free()
463
+ }
464
+ })
465
+ test("flex_direction_row_reverse_margin_left", () => {
466
+ const config = Yoga.Config.create()
467
+ let root
468
+
469
+ try {
470
+ root = Yoga.Node.create(config)
471
+ root.setFlexDirection(FlexDirection.RowReverse)
472
+ root.setPositionType(PositionType.Absolute)
473
+ root.setMargin(Edge.Left, 100)
474
+ root.setWidth(100)
475
+ root.setHeight(100)
476
+
477
+ const root_child0 = Yoga.Node.create(config)
478
+ root_child0.setWidth(10)
479
+ root.insertChild(root_child0, 0)
480
+
481
+ const root_child1 = Yoga.Node.create(config)
482
+ root_child1.setWidth(10)
483
+ root.insertChild(root_child1, 1)
484
+
485
+ const root_child2 = Yoga.Node.create(config)
486
+ root_child2.setWidth(10)
487
+ root.insertChild(root_child2, 2)
488
+ root.calculateLayout(undefined, undefined, Direction.LTR)
489
+
490
+ expect(root.getComputedLeft()).toBe(100)
491
+ expect(root.getComputedTop()).toBe(0)
492
+ expect(root.getComputedWidth()).toBe(100)
493
+ expect(root.getComputedHeight()).toBe(100)
494
+
495
+ expect(root_child0.getComputedLeft()).toBe(90)
496
+ expect(root_child0.getComputedTop()).toBe(0)
497
+ expect(root_child0.getComputedWidth()).toBe(10)
498
+ expect(root_child0.getComputedHeight()).toBe(100)
499
+
500
+ expect(root_child1.getComputedLeft()).toBe(80)
501
+ expect(root_child1.getComputedTop()).toBe(0)
502
+ expect(root_child1.getComputedWidth()).toBe(10)
503
+ expect(root_child1.getComputedHeight()).toBe(100)
504
+
505
+ expect(root_child2.getComputedLeft()).toBe(70)
506
+ expect(root_child2.getComputedTop()).toBe(0)
507
+ expect(root_child2.getComputedWidth()).toBe(10)
508
+ expect(root_child2.getComputedHeight()).toBe(100)
509
+
510
+ root.calculateLayout(undefined, undefined, Direction.RTL)
511
+
512
+ expect(root.getComputedLeft()).toBe(100)
513
+ expect(root.getComputedTop()).toBe(0)
514
+ expect(root.getComputedWidth()).toBe(100)
515
+ expect(root.getComputedHeight()).toBe(100)
516
+
517
+ expect(root_child0.getComputedLeft()).toBe(0)
518
+ expect(root_child0.getComputedTop()).toBe(0)
519
+ expect(root_child0.getComputedWidth()).toBe(10)
520
+ expect(root_child0.getComputedHeight()).toBe(100)
521
+
522
+ expect(root_child1.getComputedLeft()).toBe(10)
523
+ expect(root_child1.getComputedTop()).toBe(0)
524
+ expect(root_child1.getComputedWidth()).toBe(10)
525
+ expect(root_child1.getComputedHeight()).toBe(100)
526
+
527
+ expect(root_child2.getComputedLeft()).toBe(20)
528
+ expect(root_child2.getComputedTop()).toBe(0)
529
+ expect(root_child2.getComputedWidth()).toBe(10)
530
+ expect(root_child2.getComputedHeight()).toBe(100)
531
+ } finally {
532
+ if (typeof root !== "undefined") {
533
+ root.freeRecursive()
534
+ }
535
+
536
+ config.free()
537
+ }
538
+ })
539
+ test("flex_direction_row_reverse_margin_start", () => {
540
+ const config = Yoga.Config.create()
541
+ let root
542
+
543
+ try {
544
+ root = Yoga.Node.create(config)
545
+ root.setFlexDirection(FlexDirection.RowReverse)
546
+ root.setPositionType(PositionType.Absolute)
547
+ root.setMargin(Edge.Start, 100)
548
+ root.setWidth(100)
549
+ root.setHeight(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(100)
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
+ } finally {
606
+ if (typeof root !== "undefined") {
607
+ root.freeRecursive()
608
+ }
609
+
610
+ config.free()
611
+ }
612
+ })
613
+ test("flex_direction_row_reverse_margin_right", () => {
614
+ const config = Yoga.Config.create()
615
+ let root
616
+
617
+ try {
618
+ root = Yoga.Node.create(config)
619
+ root.setFlexDirection(FlexDirection.RowReverse)
620
+ root.setPositionType(PositionType.Absolute)
621
+ root.setMargin(Edge.Right, 100)
622
+ root.setWidth(100)
623
+ root.setHeight(100)
624
+
625
+ const root_child0 = Yoga.Node.create(config)
626
+ root_child0.setWidth(10)
627
+ root.insertChild(root_child0, 0)
628
+
629
+ const root_child1 = Yoga.Node.create(config)
630
+ root_child1.setWidth(10)
631
+ root.insertChild(root_child1, 1)
632
+
633
+ const root_child2 = Yoga.Node.create(config)
634
+ root_child2.setWidth(10)
635
+ root.insertChild(root_child2, 2)
636
+ root.calculateLayout(undefined, undefined, Direction.LTR)
637
+
638
+ expect(root.getComputedLeft()).toBe(0)
639
+ expect(root.getComputedTop()).toBe(0)
640
+ expect(root.getComputedWidth()).toBe(100)
641
+ expect(root.getComputedHeight()).toBe(100)
642
+
643
+ expect(root_child0.getComputedLeft()).toBe(90)
644
+ expect(root_child0.getComputedTop()).toBe(0)
645
+ expect(root_child0.getComputedWidth()).toBe(10)
646
+ expect(root_child0.getComputedHeight()).toBe(100)
647
+
648
+ expect(root_child1.getComputedLeft()).toBe(80)
649
+ expect(root_child1.getComputedTop()).toBe(0)
650
+ expect(root_child1.getComputedWidth()).toBe(10)
651
+ expect(root_child1.getComputedHeight()).toBe(100)
652
+
653
+ expect(root_child2.getComputedLeft()).toBe(70)
654
+ expect(root_child2.getComputedTop()).toBe(0)
655
+ expect(root_child2.getComputedWidth()).toBe(10)
656
+ expect(root_child2.getComputedHeight()).toBe(100)
657
+
658
+ root.calculateLayout(undefined, undefined, Direction.RTL)
659
+
660
+ expect(root.getComputedLeft()).toBe(0)
661
+ expect(root.getComputedTop()).toBe(0)
662
+ expect(root.getComputedWidth()).toBe(100)
663
+ expect(root.getComputedHeight()).toBe(100)
664
+
665
+ expect(root_child0.getComputedLeft()).toBe(0)
666
+ expect(root_child0.getComputedTop()).toBe(0)
667
+ expect(root_child0.getComputedWidth()).toBe(10)
668
+ expect(root_child0.getComputedHeight()).toBe(100)
669
+
670
+ expect(root_child1.getComputedLeft()).toBe(10)
671
+ expect(root_child1.getComputedTop()).toBe(0)
672
+ expect(root_child1.getComputedWidth()).toBe(10)
673
+ expect(root_child1.getComputedHeight()).toBe(100)
674
+
675
+ expect(root_child2.getComputedLeft()).toBe(20)
676
+ expect(root_child2.getComputedTop()).toBe(0)
677
+ expect(root_child2.getComputedWidth()).toBe(10)
678
+ expect(root_child2.getComputedHeight()).toBe(100)
679
+ } finally {
680
+ if (typeof root !== "undefined") {
681
+ root.freeRecursive()
682
+ }
683
+
684
+ config.free()
685
+ }
686
+ })
687
+ test("flex_direction_row_reverse_margin_end", () => {
688
+ const config = Yoga.Config.create()
689
+ let root
690
+
691
+ try {
692
+ root = Yoga.Node.create(config)
693
+ root.setFlexDirection(FlexDirection.RowReverse)
694
+ root.setPositionType(PositionType.Absolute)
695
+ root.setMargin(Edge.End, 100)
696
+ root.setWidth(100)
697
+ root.setHeight(100)
698
+
699
+ const root_child0 = Yoga.Node.create(config)
700
+ root_child0.setWidth(10)
701
+ root.insertChild(root_child0, 0)
702
+
703
+ const root_child1 = Yoga.Node.create(config)
704
+ root_child1.setWidth(10)
705
+ root.insertChild(root_child1, 1)
706
+
707
+ const root_child2 = Yoga.Node.create(config)
708
+ root_child2.setWidth(10)
709
+ root.insertChild(root_child2, 2)
710
+ root.calculateLayout(undefined, undefined, Direction.LTR)
711
+
712
+ expect(root.getComputedLeft()).toBe(0)
713
+ expect(root.getComputedTop()).toBe(0)
714
+ expect(root.getComputedWidth()).toBe(100)
715
+ expect(root.getComputedHeight()).toBe(100)
716
+
717
+ expect(root_child0.getComputedLeft()).toBe(90)
718
+ expect(root_child0.getComputedTop()).toBe(0)
719
+ expect(root_child0.getComputedWidth()).toBe(10)
720
+ expect(root_child0.getComputedHeight()).toBe(100)
721
+
722
+ expect(root_child1.getComputedLeft()).toBe(80)
723
+ expect(root_child1.getComputedTop()).toBe(0)
724
+ expect(root_child1.getComputedWidth()).toBe(10)
725
+ expect(root_child1.getComputedHeight()).toBe(100)
726
+
727
+ expect(root_child2.getComputedLeft()).toBe(70)
728
+ expect(root_child2.getComputedTop()).toBe(0)
729
+ expect(root_child2.getComputedWidth()).toBe(10)
730
+ expect(root_child2.getComputedHeight()).toBe(100)
731
+
732
+ root.calculateLayout(undefined, undefined, Direction.RTL)
733
+
734
+ expect(root.getComputedLeft()).toBe(100)
735
+ expect(root.getComputedTop()).toBe(0)
736
+ expect(root.getComputedWidth()).toBe(100)
737
+ expect(root.getComputedHeight()).toBe(100)
738
+
739
+ expect(root_child0.getComputedLeft()).toBe(0)
740
+ expect(root_child0.getComputedTop()).toBe(0)
741
+ expect(root_child0.getComputedWidth()).toBe(10)
742
+ expect(root_child0.getComputedHeight()).toBe(100)
743
+
744
+ expect(root_child1.getComputedLeft()).toBe(10)
745
+ expect(root_child1.getComputedTop()).toBe(0)
746
+ expect(root_child1.getComputedWidth()).toBe(10)
747
+ expect(root_child1.getComputedHeight()).toBe(100)
748
+
749
+ expect(root_child2.getComputedLeft()).toBe(20)
750
+ expect(root_child2.getComputedTop()).toBe(0)
751
+ expect(root_child2.getComputedWidth()).toBe(10)
752
+ expect(root_child2.getComputedHeight()).toBe(100)
753
+ } finally {
754
+ if (typeof root !== "undefined") {
755
+ root.freeRecursive()
756
+ }
757
+
758
+ config.free()
759
+ }
760
+ })
761
+ test("flex_direction_column_reverse_margin_top", () => {
762
+ const config = Yoga.Config.create()
763
+ let root
764
+
765
+ try {
766
+ root = Yoga.Node.create(config)
767
+ root.setFlexDirection(FlexDirection.ColumnReverse)
768
+ root.setPositionType(PositionType.Absolute)
769
+ root.setMargin(Edge.Top, 100)
770
+ root.setWidth(100)
771
+ root.setHeight(100)
772
+
773
+ const root_child0 = Yoga.Node.create(config)
774
+ root_child0.setWidth(10)
775
+ root.insertChild(root_child0, 0)
776
+
777
+ const root_child1 = Yoga.Node.create(config)
778
+ root_child1.setWidth(10)
779
+ root.insertChild(root_child1, 1)
780
+
781
+ const root_child2 = Yoga.Node.create(config)
782
+ root_child2.setWidth(10)
783
+ root.insertChild(root_child2, 2)
784
+ root.calculateLayout(undefined, undefined, Direction.LTR)
785
+
786
+ expect(root.getComputedLeft()).toBe(0)
787
+ expect(root.getComputedTop()).toBe(100)
788
+ expect(root.getComputedWidth()).toBe(100)
789
+ expect(root.getComputedHeight()).toBe(100)
790
+
791
+ expect(root_child0.getComputedLeft()).toBe(0)
792
+ expect(root_child0.getComputedTop()).toBe(100)
793
+ expect(root_child0.getComputedWidth()).toBe(10)
794
+ expect(root_child0.getComputedHeight()).toBe(0)
795
+
796
+ expect(root_child1.getComputedLeft()).toBe(0)
797
+ expect(root_child1.getComputedTop()).toBe(100)
798
+ expect(root_child1.getComputedWidth()).toBe(10)
799
+ expect(root_child1.getComputedHeight()).toBe(0)
800
+
801
+ expect(root_child2.getComputedLeft()).toBe(0)
802
+ expect(root_child2.getComputedTop()).toBe(100)
803
+ expect(root_child2.getComputedWidth()).toBe(10)
804
+ expect(root_child2.getComputedHeight()).toBe(0)
805
+
806
+ root.calculateLayout(undefined, undefined, Direction.RTL)
807
+
808
+ expect(root.getComputedLeft()).toBe(0)
809
+ expect(root.getComputedTop()).toBe(100)
810
+ expect(root.getComputedWidth()).toBe(100)
811
+ expect(root.getComputedHeight()).toBe(100)
812
+
813
+ expect(root_child0.getComputedLeft()).toBe(90)
814
+ expect(root_child0.getComputedTop()).toBe(100)
815
+ expect(root_child0.getComputedWidth()).toBe(10)
816
+ expect(root_child0.getComputedHeight()).toBe(0)
817
+
818
+ expect(root_child1.getComputedLeft()).toBe(90)
819
+ expect(root_child1.getComputedTop()).toBe(100)
820
+ expect(root_child1.getComputedWidth()).toBe(10)
821
+ expect(root_child1.getComputedHeight()).toBe(0)
822
+
823
+ expect(root_child2.getComputedLeft()).toBe(90)
824
+ expect(root_child2.getComputedTop()).toBe(100)
825
+ expect(root_child2.getComputedWidth()).toBe(10)
826
+ expect(root_child2.getComputedHeight()).toBe(0)
827
+ } finally {
828
+ if (typeof root !== "undefined") {
829
+ root.freeRecursive()
830
+ }
831
+
832
+ config.free()
833
+ }
834
+ })
835
+ test("flex_direction_column_reverse_margin_bottom", () => {
836
+ const config = Yoga.Config.create()
837
+ let root
838
+
839
+ try {
840
+ root = Yoga.Node.create(config)
841
+ root.setFlexDirection(FlexDirection.ColumnReverse)
842
+ root.setPositionType(PositionType.Absolute)
843
+ root.setMargin(Edge.Bottom, 100)
844
+ root.setWidth(100)
845
+ root.setHeight(100)
846
+
847
+ const root_child0 = Yoga.Node.create(config)
848
+ root_child0.setWidth(10)
849
+ root.insertChild(root_child0, 0)
850
+
851
+ const root_child1 = Yoga.Node.create(config)
852
+ root_child1.setWidth(10)
853
+ root.insertChild(root_child1, 1)
854
+
855
+ const root_child2 = Yoga.Node.create(config)
856
+ root_child2.setWidth(10)
857
+ root.insertChild(root_child2, 2)
858
+ root.calculateLayout(undefined, undefined, Direction.LTR)
859
+
860
+ expect(root.getComputedLeft()).toBe(0)
861
+ expect(root.getComputedTop()).toBe(0)
862
+ expect(root.getComputedWidth()).toBe(100)
863
+ expect(root.getComputedHeight()).toBe(100)
864
+
865
+ expect(root_child0.getComputedLeft()).toBe(0)
866
+ expect(root_child0.getComputedTop()).toBe(100)
867
+ expect(root_child0.getComputedWidth()).toBe(10)
868
+ expect(root_child0.getComputedHeight()).toBe(0)
869
+
870
+ expect(root_child1.getComputedLeft()).toBe(0)
871
+ expect(root_child1.getComputedTop()).toBe(100)
872
+ expect(root_child1.getComputedWidth()).toBe(10)
873
+ expect(root_child1.getComputedHeight()).toBe(0)
874
+
875
+ expect(root_child2.getComputedLeft()).toBe(0)
876
+ expect(root_child2.getComputedTop()).toBe(100)
877
+ expect(root_child2.getComputedWidth()).toBe(10)
878
+ expect(root_child2.getComputedHeight()).toBe(0)
879
+
880
+ root.calculateLayout(undefined, undefined, Direction.RTL)
881
+
882
+ expect(root.getComputedLeft()).toBe(0)
883
+ expect(root.getComputedTop()).toBe(0)
884
+ expect(root.getComputedWidth()).toBe(100)
885
+ expect(root.getComputedHeight()).toBe(100)
886
+
887
+ expect(root_child0.getComputedLeft()).toBe(90)
888
+ expect(root_child0.getComputedTop()).toBe(100)
889
+ expect(root_child0.getComputedWidth()).toBe(10)
890
+ expect(root_child0.getComputedHeight()).toBe(0)
891
+
892
+ expect(root_child1.getComputedLeft()).toBe(90)
893
+ expect(root_child1.getComputedTop()).toBe(100)
894
+ expect(root_child1.getComputedWidth()).toBe(10)
895
+ expect(root_child1.getComputedHeight()).toBe(0)
896
+
897
+ expect(root_child2.getComputedLeft()).toBe(90)
898
+ expect(root_child2.getComputedTop()).toBe(100)
899
+ expect(root_child2.getComputedWidth()).toBe(10)
900
+ expect(root_child2.getComputedHeight()).toBe(0)
901
+ } finally {
902
+ if (typeof root !== "undefined") {
903
+ root.freeRecursive()
904
+ }
905
+
906
+ config.free()
907
+ }
908
+ })
909
+ test("flex_direction_row_reverse_padding_left", () => {
910
+ const config = Yoga.Config.create()
911
+ let root
912
+
913
+ try {
914
+ root = Yoga.Node.create(config)
915
+ root.setFlexDirection(FlexDirection.RowReverse)
916
+ root.setPositionType(PositionType.Absolute)
917
+ root.setPadding(Edge.Left, 100)
918
+ root.setWidth(100)
919
+ root.setHeight(100)
920
+
921
+ const root_child0 = Yoga.Node.create(config)
922
+ root_child0.setWidth(10)
923
+ root.insertChild(root_child0, 0)
924
+
925
+ const root_child1 = Yoga.Node.create(config)
926
+ root_child1.setWidth(10)
927
+ root.insertChild(root_child1, 1)
928
+
929
+ const root_child2 = Yoga.Node.create(config)
930
+ root_child2.setWidth(10)
931
+ root.insertChild(root_child2, 2)
932
+ root.calculateLayout(undefined, undefined, Direction.LTR)
933
+
934
+ expect(root.getComputedLeft()).toBe(0)
935
+ expect(root.getComputedTop()).toBe(0)
936
+ expect(root.getComputedWidth()).toBe(100)
937
+ expect(root.getComputedHeight()).toBe(100)
938
+
939
+ expect(root_child0.getComputedLeft()).toBe(90)
940
+ expect(root_child0.getComputedTop()).toBe(0)
941
+ expect(root_child0.getComputedWidth()).toBe(10)
942
+ expect(root_child0.getComputedHeight()).toBe(100)
943
+
944
+ expect(root_child1.getComputedLeft()).toBe(80)
945
+ expect(root_child1.getComputedTop()).toBe(0)
946
+ expect(root_child1.getComputedWidth()).toBe(10)
947
+ expect(root_child1.getComputedHeight()).toBe(100)
948
+
949
+ expect(root_child2.getComputedLeft()).toBe(70)
950
+ expect(root_child2.getComputedTop()).toBe(0)
951
+ expect(root_child2.getComputedWidth()).toBe(10)
952
+ expect(root_child2.getComputedHeight()).toBe(100)
953
+
954
+ root.calculateLayout(undefined, undefined, Direction.RTL)
955
+
956
+ expect(root.getComputedLeft()).toBe(0)
957
+ expect(root.getComputedTop()).toBe(0)
958
+ expect(root.getComputedWidth()).toBe(100)
959
+ expect(root.getComputedHeight()).toBe(100)
960
+
961
+ expect(root_child0.getComputedLeft()).toBe(100)
962
+ expect(root_child0.getComputedTop()).toBe(0)
963
+ expect(root_child0.getComputedWidth()).toBe(10)
964
+ expect(root_child0.getComputedHeight()).toBe(100)
965
+
966
+ expect(root_child1.getComputedLeft()).toBe(110)
967
+ expect(root_child1.getComputedTop()).toBe(0)
968
+ expect(root_child1.getComputedWidth()).toBe(10)
969
+ expect(root_child1.getComputedHeight()).toBe(100)
970
+
971
+ expect(root_child2.getComputedLeft()).toBe(120)
972
+ expect(root_child2.getComputedTop()).toBe(0)
973
+ expect(root_child2.getComputedWidth()).toBe(10)
974
+ expect(root_child2.getComputedHeight()).toBe(100)
975
+ } finally {
976
+ if (typeof root !== "undefined") {
977
+ root.freeRecursive()
978
+ }
979
+
980
+ config.free()
981
+ }
982
+ })
983
+ test("flex_direction_row_reverse_padding_start", () => {
984
+ const config = Yoga.Config.create()
985
+ let root
986
+
987
+ try {
988
+ root = Yoga.Node.create(config)
989
+ root.setFlexDirection(FlexDirection.RowReverse)
990
+ root.setPositionType(PositionType.Absolute)
991
+ root.setPadding(Edge.Start, 100)
992
+ root.setWidth(100)
993
+ root.setHeight(100)
994
+
995
+ const root_child0 = Yoga.Node.create(config)
996
+ root_child0.setWidth(10)
997
+ root.insertChild(root_child0, 0)
998
+
999
+ const root_child1 = Yoga.Node.create(config)
1000
+ root_child1.setWidth(10)
1001
+ root.insertChild(root_child1, 1)
1002
+
1003
+ const root_child2 = Yoga.Node.create(config)
1004
+ root_child2.setWidth(10)
1005
+ root.insertChild(root_child2, 2)
1006
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1007
+
1008
+ expect(root.getComputedLeft()).toBe(0)
1009
+ expect(root.getComputedTop()).toBe(0)
1010
+ expect(root.getComputedWidth()).toBe(100)
1011
+ expect(root.getComputedHeight()).toBe(100)
1012
+
1013
+ expect(root_child0.getComputedLeft()).toBe(90)
1014
+ expect(root_child0.getComputedTop()).toBe(0)
1015
+ expect(root_child0.getComputedWidth()).toBe(10)
1016
+ expect(root_child0.getComputedHeight()).toBe(100)
1017
+
1018
+ expect(root_child1.getComputedLeft()).toBe(80)
1019
+ expect(root_child1.getComputedTop()).toBe(0)
1020
+ expect(root_child1.getComputedWidth()).toBe(10)
1021
+ expect(root_child1.getComputedHeight()).toBe(100)
1022
+
1023
+ expect(root_child2.getComputedLeft()).toBe(70)
1024
+ expect(root_child2.getComputedTop()).toBe(0)
1025
+ expect(root_child2.getComputedWidth()).toBe(10)
1026
+ expect(root_child2.getComputedHeight()).toBe(100)
1027
+
1028
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1029
+
1030
+ expect(root.getComputedLeft()).toBe(0)
1031
+ expect(root.getComputedTop()).toBe(0)
1032
+ expect(root.getComputedWidth()).toBe(100)
1033
+ expect(root.getComputedHeight()).toBe(100)
1034
+
1035
+ expect(root_child0.getComputedLeft()).toBe(0)
1036
+ expect(root_child0.getComputedTop()).toBe(0)
1037
+ expect(root_child0.getComputedWidth()).toBe(10)
1038
+ expect(root_child0.getComputedHeight()).toBe(100)
1039
+
1040
+ expect(root_child1.getComputedLeft()).toBe(10)
1041
+ expect(root_child1.getComputedTop()).toBe(0)
1042
+ expect(root_child1.getComputedWidth()).toBe(10)
1043
+ expect(root_child1.getComputedHeight()).toBe(100)
1044
+
1045
+ expect(root_child2.getComputedLeft()).toBe(20)
1046
+ expect(root_child2.getComputedTop()).toBe(0)
1047
+ expect(root_child2.getComputedWidth()).toBe(10)
1048
+ expect(root_child2.getComputedHeight()).toBe(100)
1049
+ } finally {
1050
+ if (typeof root !== "undefined") {
1051
+ root.freeRecursive()
1052
+ }
1053
+
1054
+ config.free()
1055
+ }
1056
+ })
1057
+ test("flex_direction_row_reverse_padding_right", () => {
1058
+ const config = Yoga.Config.create()
1059
+ let root
1060
+
1061
+ try {
1062
+ root = Yoga.Node.create(config)
1063
+ root.setFlexDirection(FlexDirection.RowReverse)
1064
+ root.setPositionType(PositionType.Absolute)
1065
+ root.setPadding(Edge.Right, 100)
1066
+ root.setWidth(100)
1067
+ root.setHeight(100)
1068
+
1069
+ const root_child0 = Yoga.Node.create(config)
1070
+ root_child0.setWidth(10)
1071
+ root.insertChild(root_child0, 0)
1072
+
1073
+ const root_child1 = Yoga.Node.create(config)
1074
+ root_child1.setWidth(10)
1075
+ root.insertChild(root_child1, 1)
1076
+
1077
+ const root_child2 = Yoga.Node.create(config)
1078
+ root_child2.setWidth(10)
1079
+ root.insertChild(root_child2, 2)
1080
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1081
+
1082
+ expect(root.getComputedLeft()).toBe(0)
1083
+ expect(root.getComputedTop()).toBe(0)
1084
+ expect(root.getComputedWidth()).toBe(100)
1085
+ expect(root.getComputedHeight()).toBe(100)
1086
+
1087
+ expect(root_child0.getComputedLeft()).toBe(-10)
1088
+ expect(root_child0.getComputedTop()).toBe(0)
1089
+ expect(root_child0.getComputedWidth()).toBe(10)
1090
+ expect(root_child0.getComputedHeight()).toBe(100)
1091
+
1092
+ expect(root_child1.getComputedLeft()).toBe(-20)
1093
+ expect(root_child1.getComputedTop()).toBe(0)
1094
+ expect(root_child1.getComputedWidth()).toBe(10)
1095
+ expect(root_child1.getComputedHeight()).toBe(100)
1096
+
1097
+ expect(root_child2.getComputedLeft()).toBe(-30)
1098
+ expect(root_child2.getComputedTop()).toBe(0)
1099
+ expect(root_child2.getComputedWidth()).toBe(10)
1100
+ expect(root_child2.getComputedHeight()).toBe(100)
1101
+
1102
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1103
+
1104
+ expect(root.getComputedLeft()).toBe(0)
1105
+ expect(root.getComputedTop()).toBe(0)
1106
+ expect(root.getComputedWidth()).toBe(100)
1107
+ expect(root.getComputedHeight()).toBe(100)
1108
+
1109
+ expect(root_child0.getComputedLeft()).toBe(0)
1110
+ expect(root_child0.getComputedTop()).toBe(0)
1111
+ expect(root_child0.getComputedWidth()).toBe(10)
1112
+ expect(root_child0.getComputedHeight()).toBe(100)
1113
+
1114
+ expect(root_child1.getComputedLeft()).toBe(10)
1115
+ expect(root_child1.getComputedTop()).toBe(0)
1116
+ expect(root_child1.getComputedWidth()).toBe(10)
1117
+ expect(root_child1.getComputedHeight()).toBe(100)
1118
+
1119
+ expect(root_child2.getComputedLeft()).toBe(20)
1120
+ expect(root_child2.getComputedTop()).toBe(0)
1121
+ expect(root_child2.getComputedWidth()).toBe(10)
1122
+ expect(root_child2.getComputedHeight()).toBe(100)
1123
+ } finally {
1124
+ if (typeof root !== "undefined") {
1125
+ root.freeRecursive()
1126
+ }
1127
+
1128
+ config.free()
1129
+ }
1130
+ })
1131
+ test("flex_direction_row_reverse_padding_end", () => {
1132
+ const config = Yoga.Config.create()
1133
+ let root
1134
+
1135
+ try {
1136
+ root = Yoga.Node.create(config)
1137
+ root.setFlexDirection(FlexDirection.RowReverse)
1138
+ root.setPositionType(PositionType.Absolute)
1139
+ root.setPadding(Edge.End, 100)
1140
+ root.setWidth(100)
1141
+ root.setHeight(100)
1142
+
1143
+ const root_child0 = Yoga.Node.create(config)
1144
+ root_child0.setWidth(10)
1145
+ root.insertChild(root_child0, 0)
1146
+
1147
+ const root_child1 = Yoga.Node.create(config)
1148
+ root_child1.setWidth(10)
1149
+ root.insertChild(root_child1, 1)
1150
+
1151
+ const root_child2 = Yoga.Node.create(config)
1152
+ root_child2.setWidth(10)
1153
+ root.insertChild(root_child2, 2)
1154
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1155
+
1156
+ expect(root.getComputedLeft()).toBe(0)
1157
+ expect(root.getComputedTop()).toBe(0)
1158
+ expect(root.getComputedWidth()).toBe(100)
1159
+ expect(root.getComputedHeight()).toBe(100)
1160
+
1161
+ expect(root_child0.getComputedLeft()).toBe(-10)
1162
+ expect(root_child0.getComputedTop()).toBe(0)
1163
+ expect(root_child0.getComputedWidth()).toBe(10)
1164
+ expect(root_child0.getComputedHeight()).toBe(100)
1165
+
1166
+ expect(root_child1.getComputedLeft()).toBe(-20)
1167
+ expect(root_child1.getComputedTop()).toBe(0)
1168
+ expect(root_child1.getComputedWidth()).toBe(10)
1169
+ expect(root_child1.getComputedHeight()).toBe(100)
1170
+
1171
+ expect(root_child2.getComputedLeft()).toBe(-30)
1172
+ expect(root_child2.getComputedTop()).toBe(0)
1173
+ expect(root_child2.getComputedWidth()).toBe(10)
1174
+ expect(root_child2.getComputedHeight()).toBe(100)
1175
+
1176
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1177
+
1178
+ expect(root.getComputedLeft()).toBe(0)
1179
+ expect(root.getComputedTop()).toBe(0)
1180
+ expect(root.getComputedWidth()).toBe(100)
1181
+ expect(root.getComputedHeight()).toBe(100)
1182
+
1183
+ expect(root_child0.getComputedLeft()).toBe(100)
1184
+ expect(root_child0.getComputedTop()).toBe(0)
1185
+ expect(root_child0.getComputedWidth()).toBe(10)
1186
+ expect(root_child0.getComputedHeight()).toBe(100)
1187
+
1188
+ expect(root_child1.getComputedLeft()).toBe(110)
1189
+ expect(root_child1.getComputedTop()).toBe(0)
1190
+ expect(root_child1.getComputedWidth()).toBe(10)
1191
+ expect(root_child1.getComputedHeight()).toBe(100)
1192
+
1193
+ expect(root_child2.getComputedLeft()).toBe(120)
1194
+ expect(root_child2.getComputedTop()).toBe(0)
1195
+ expect(root_child2.getComputedWidth()).toBe(10)
1196
+ expect(root_child2.getComputedHeight()).toBe(100)
1197
+ } finally {
1198
+ if (typeof root !== "undefined") {
1199
+ root.freeRecursive()
1200
+ }
1201
+
1202
+ config.free()
1203
+ }
1204
+ })
1205
+ test("flex_direction_column_reverse_padding_top", () => {
1206
+ const config = Yoga.Config.create()
1207
+ let root
1208
+
1209
+ try {
1210
+ root = Yoga.Node.create(config)
1211
+ root.setFlexDirection(FlexDirection.ColumnReverse)
1212
+ root.setPositionType(PositionType.Absolute)
1213
+ root.setPadding(Edge.Top, 100)
1214
+ root.setWidth(100)
1215
+ root.setHeight(100)
1216
+
1217
+ const root_child0 = Yoga.Node.create(config)
1218
+ root_child0.setWidth(10)
1219
+ root.insertChild(root_child0, 0)
1220
+
1221
+ const root_child1 = Yoga.Node.create(config)
1222
+ root_child1.setWidth(10)
1223
+ root.insertChild(root_child1, 1)
1224
+
1225
+ const root_child2 = Yoga.Node.create(config)
1226
+ root_child2.setWidth(10)
1227
+ root.insertChild(root_child2, 2)
1228
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1229
+
1230
+ expect(root.getComputedLeft()).toBe(0)
1231
+ expect(root.getComputedTop()).toBe(0)
1232
+ expect(root.getComputedWidth()).toBe(100)
1233
+ expect(root.getComputedHeight()).toBe(100)
1234
+
1235
+ expect(root_child0.getComputedLeft()).toBe(0)
1236
+ expect(root_child0.getComputedTop()).toBe(100)
1237
+ expect(root_child0.getComputedWidth()).toBe(10)
1238
+ expect(root_child0.getComputedHeight()).toBe(0)
1239
+
1240
+ expect(root_child1.getComputedLeft()).toBe(0)
1241
+ expect(root_child1.getComputedTop()).toBe(100)
1242
+ expect(root_child1.getComputedWidth()).toBe(10)
1243
+ expect(root_child1.getComputedHeight()).toBe(0)
1244
+
1245
+ expect(root_child2.getComputedLeft()).toBe(0)
1246
+ expect(root_child2.getComputedTop()).toBe(100)
1247
+ expect(root_child2.getComputedWidth()).toBe(10)
1248
+ expect(root_child2.getComputedHeight()).toBe(0)
1249
+
1250
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1251
+
1252
+ expect(root.getComputedLeft()).toBe(0)
1253
+ expect(root.getComputedTop()).toBe(0)
1254
+ expect(root.getComputedWidth()).toBe(100)
1255
+ expect(root.getComputedHeight()).toBe(100)
1256
+
1257
+ expect(root_child0.getComputedLeft()).toBe(90)
1258
+ expect(root_child0.getComputedTop()).toBe(100)
1259
+ expect(root_child0.getComputedWidth()).toBe(10)
1260
+ expect(root_child0.getComputedHeight()).toBe(0)
1261
+
1262
+ expect(root_child1.getComputedLeft()).toBe(90)
1263
+ expect(root_child1.getComputedTop()).toBe(100)
1264
+ expect(root_child1.getComputedWidth()).toBe(10)
1265
+ expect(root_child1.getComputedHeight()).toBe(0)
1266
+
1267
+ expect(root_child2.getComputedLeft()).toBe(90)
1268
+ expect(root_child2.getComputedTop()).toBe(100)
1269
+ expect(root_child2.getComputedWidth()).toBe(10)
1270
+ expect(root_child2.getComputedHeight()).toBe(0)
1271
+ } finally {
1272
+ if (typeof root !== "undefined") {
1273
+ root.freeRecursive()
1274
+ }
1275
+
1276
+ config.free()
1277
+ }
1278
+ })
1279
+ test("flex_direction_column_reverse_padding_bottom", () => {
1280
+ const config = Yoga.Config.create()
1281
+ let root
1282
+
1283
+ try {
1284
+ root = Yoga.Node.create(config)
1285
+ root.setFlexDirection(FlexDirection.ColumnReverse)
1286
+ root.setPositionType(PositionType.Absolute)
1287
+ root.setPadding(Edge.Bottom, 100)
1288
+ root.setWidth(100)
1289
+ root.setHeight(100)
1290
+
1291
+ const root_child0 = Yoga.Node.create(config)
1292
+ root_child0.setWidth(10)
1293
+ root.insertChild(root_child0, 0)
1294
+
1295
+ const root_child1 = Yoga.Node.create(config)
1296
+ root_child1.setWidth(10)
1297
+ root.insertChild(root_child1, 1)
1298
+
1299
+ const root_child2 = Yoga.Node.create(config)
1300
+ root_child2.setWidth(10)
1301
+ root.insertChild(root_child2, 2)
1302
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1303
+
1304
+ expect(root.getComputedLeft()).toBe(0)
1305
+ expect(root.getComputedTop()).toBe(0)
1306
+ expect(root.getComputedWidth()).toBe(100)
1307
+ expect(root.getComputedHeight()).toBe(100)
1308
+
1309
+ expect(root_child0.getComputedLeft()).toBe(0)
1310
+ expect(root_child0.getComputedTop()).toBe(0)
1311
+ expect(root_child0.getComputedWidth()).toBe(10)
1312
+ expect(root_child0.getComputedHeight()).toBe(0)
1313
+
1314
+ expect(root_child1.getComputedLeft()).toBe(0)
1315
+ expect(root_child1.getComputedTop()).toBe(0)
1316
+ expect(root_child1.getComputedWidth()).toBe(10)
1317
+ expect(root_child1.getComputedHeight()).toBe(0)
1318
+
1319
+ expect(root_child2.getComputedLeft()).toBe(0)
1320
+ expect(root_child2.getComputedTop()).toBe(0)
1321
+ expect(root_child2.getComputedWidth()).toBe(10)
1322
+ expect(root_child2.getComputedHeight()).toBe(0)
1323
+
1324
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1325
+
1326
+ expect(root.getComputedLeft()).toBe(0)
1327
+ expect(root.getComputedTop()).toBe(0)
1328
+ expect(root.getComputedWidth()).toBe(100)
1329
+ expect(root.getComputedHeight()).toBe(100)
1330
+
1331
+ expect(root_child0.getComputedLeft()).toBe(90)
1332
+ expect(root_child0.getComputedTop()).toBe(0)
1333
+ expect(root_child0.getComputedWidth()).toBe(10)
1334
+ expect(root_child0.getComputedHeight()).toBe(0)
1335
+
1336
+ expect(root_child1.getComputedLeft()).toBe(90)
1337
+ expect(root_child1.getComputedTop()).toBe(0)
1338
+ expect(root_child1.getComputedWidth()).toBe(10)
1339
+ expect(root_child1.getComputedHeight()).toBe(0)
1340
+
1341
+ expect(root_child2.getComputedLeft()).toBe(90)
1342
+ expect(root_child2.getComputedTop()).toBe(0)
1343
+ expect(root_child2.getComputedWidth()).toBe(10)
1344
+ expect(root_child2.getComputedHeight()).toBe(0)
1345
+ } finally {
1346
+ if (typeof root !== "undefined") {
1347
+ root.freeRecursive()
1348
+ }
1349
+
1350
+ config.free()
1351
+ }
1352
+ })
1353
+ test("flex_direction_row_reverse_border_left", () => {
1354
+ const config = Yoga.Config.create()
1355
+ let root
1356
+
1357
+ try {
1358
+ root = Yoga.Node.create(config)
1359
+ root.setFlexDirection(FlexDirection.RowReverse)
1360
+ root.setPositionType(PositionType.Absolute)
1361
+ root.setBorder(Edge.Left, 100)
1362
+ root.setWidth(100)
1363
+ root.setHeight(100)
1364
+
1365
+ const root_child0 = Yoga.Node.create(config)
1366
+ root_child0.setWidth(10)
1367
+ root.insertChild(root_child0, 0)
1368
+
1369
+ const root_child1 = Yoga.Node.create(config)
1370
+ root_child1.setWidth(10)
1371
+ root.insertChild(root_child1, 1)
1372
+
1373
+ const root_child2 = Yoga.Node.create(config)
1374
+ root_child2.setWidth(10)
1375
+ root.insertChild(root_child2, 2)
1376
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1377
+
1378
+ expect(root.getComputedLeft()).toBe(0)
1379
+ expect(root.getComputedTop()).toBe(0)
1380
+ expect(root.getComputedWidth()).toBe(100)
1381
+ expect(root.getComputedHeight()).toBe(100)
1382
+
1383
+ expect(root_child0.getComputedLeft()).toBe(90)
1384
+ expect(root_child0.getComputedTop()).toBe(0)
1385
+ expect(root_child0.getComputedWidth()).toBe(10)
1386
+ expect(root_child0.getComputedHeight()).toBe(100)
1387
+
1388
+ expect(root_child1.getComputedLeft()).toBe(80)
1389
+ expect(root_child1.getComputedTop()).toBe(0)
1390
+ expect(root_child1.getComputedWidth()).toBe(10)
1391
+ expect(root_child1.getComputedHeight()).toBe(100)
1392
+
1393
+ expect(root_child2.getComputedLeft()).toBe(70)
1394
+ expect(root_child2.getComputedTop()).toBe(0)
1395
+ expect(root_child2.getComputedWidth()).toBe(10)
1396
+ expect(root_child2.getComputedHeight()).toBe(100)
1397
+
1398
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1399
+
1400
+ expect(root.getComputedLeft()).toBe(0)
1401
+ expect(root.getComputedTop()).toBe(0)
1402
+ expect(root.getComputedWidth()).toBe(100)
1403
+ expect(root.getComputedHeight()).toBe(100)
1404
+
1405
+ expect(root_child0.getComputedLeft()).toBe(100)
1406
+ expect(root_child0.getComputedTop()).toBe(0)
1407
+ expect(root_child0.getComputedWidth()).toBe(10)
1408
+ expect(root_child0.getComputedHeight()).toBe(100)
1409
+
1410
+ expect(root_child1.getComputedLeft()).toBe(110)
1411
+ expect(root_child1.getComputedTop()).toBe(0)
1412
+ expect(root_child1.getComputedWidth()).toBe(10)
1413
+ expect(root_child1.getComputedHeight()).toBe(100)
1414
+
1415
+ expect(root_child2.getComputedLeft()).toBe(120)
1416
+ expect(root_child2.getComputedTop()).toBe(0)
1417
+ expect(root_child2.getComputedWidth()).toBe(10)
1418
+ expect(root_child2.getComputedHeight()).toBe(100)
1419
+ } finally {
1420
+ if (typeof root !== "undefined") {
1421
+ root.freeRecursive()
1422
+ }
1423
+
1424
+ config.free()
1425
+ }
1426
+ })
1427
+ test("flex_direction_row_reverse_border_start", () => {
1428
+ const config = Yoga.Config.create()
1429
+ let root
1430
+
1431
+ try {
1432
+ root = Yoga.Node.create(config)
1433
+ root.setFlexDirection(FlexDirection.RowReverse)
1434
+ root.setPositionType(PositionType.Absolute)
1435
+ root.setBorder(Edge.Start, 100)
1436
+ root.setWidth(100)
1437
+ root.setHeight(100)
1438
+
1439
+ const root_child0 = Yoga.Node.create(config)
1440
+ root_child0.setWidth(10)
1441
+ root.insertChild(root_child0, 0)
1442
+
1443
+ const root_child1 = Yoga.Node.create(config)
1444
+ root_child1.setWidth(10)
1445
+ root.insertChild(root_child1, 1)
1446
+
1447
+ const root_child2 = Yoga.Node.create(config)
1448
+ root_child2.setWidth(10)
1449
+ root.insertChild(root_child2, 2)
1450
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1451
+
1452
+ expect(root.getComputedLeft()).toBe(0)
1453
+ expect(root.getComputedTop()).toBe(0)
1454
+ expect(root.getComputedWidth()).toBe(100)
1455
+ expect(root.getComputedHeight()).toBe(100)
1456
+
1457
+ expect(root_child0.getComputedLeft()).toBe(90)
1458
+ expect(root_child0.getComputedTop()).toBe(0)
1459
+ expect(root_child0.getComputedWidth()).toBe(10)
1460
+ expect(root_child0.getComputedHeight()).toBe(100)
1461
+
1462
+ expect(root_child1.getComputedLeft()).toBe(80)
1463
+ expect(root_child1.getComputedTop()).toBe(0)
1464
+ expect(root_child1.getComputedWidth()).toBe(10)
1465
+ expect(root_child1.getComputedHeight()).toBe(100)
1466
+
1467
+ expect(root_child2.getComputedLeft()).toBe(70)
1468
+ expect(root_child2.getComputedTop()).toBe(0)
1469
+ expect(root_child2.getComputedWidth()).toBe(10)
1470
+ expect(root_child2.getComputedHeight()).toBe(100)
1471
+
1472
+ root.calculateLayout(undefined, undefined, Direction.RTL)
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(0)
1481
+ expect(root_child0.getComputedWidth()).toBe(10)
1482
+ expect(root_child0.getComputedHeight()).toBe(100)
1483
+
1484
+ expect(root_child1.getComputedLeft()).toBe(10)
1485
+ expect(root_child1.getComputedTop()).toBe(0)
1486
+ expect(root_child1.getComputedWidth()).toBe(10)
1487
+ expect(root_child1.getComputedHeight()).toBe(100)
1488
+
1489
+ expect(root_child2.getComputedLeft()).toBe(20)
1490
+ expect(root_child2.getComputedTop()).toBe(0)
1491
+ expect(root_child2.getComputedWidth()).toBe(10)
1492
+ expect(root_child2.getComputedHeight()).toBe(100)
1493
+ } finally {
1494
+ if (typeof root !== "undefined") {
1495
+ root.freeRecursive()
1496
+ }
1497
+
1498
+ config.free()
1499
+ }
1500
+ })
1501
+ test("flex_direction_row_reverse_border_right", () => {
1502
+ const config = Yoga.Config.create()
1503
+ let root
1504
+
1505
+ try {
1506
+ root = Yoga.Node.create(config)
1507
+ root.setFlexDirection(FlexDirection.RowReverse)
1508
+ root.setPositionType(PositionType.Absolute)
1509
+ root.setBorder(Edge.Right, 100)
1510
+ root.setWidth(100)
1511
+ root.setHeight(100)
1512
+
1513
+ const root_child0 = Yoga.Node.create(config)
1514
+ root_child0.setWidth(10)
1515
+ root.insertChild(root_child0, 0)
1516
+
1517
+ const root_child1 = Yoga.Node.create(config)
1518
+ root_child1.setWidth(10)
1519
+ root.insertChild(root_child1, 1)
1520
+
1521
+ const root_child2 = Yoga.Node.create(config)
1522
+ root_child2.setWidth(10)
1523
+ root.insertChild(root_child2, 2)
1524
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1525
+
1526
+ expect(root.getComputedLeft()).toBe(0)
1527
+ expect(root.getComputedTop()).toBe(0)
1528
+ expect(root.getComputedWidth()).toBe(100)
1529
+ expect(root.getComputedHeight()).toBe(100)
1530
+
1531
+ expect(root_child0.getComputedLeft()).toBe(-10)
1532
+ expect(root_child0.getComputedTop()).toBe(0)
1533
+ expect(root_child0.getComputedWidth()).toBe(10)
1534
+ expect(root_child0.getComputedHeight()).toBe(100)
1535
+
1536
+ expect(root_child1.getComputedLeft()).toBe(-20)
1537
+ expect(root_child1.getComputedTop()).toBe(0)
1538
+ expect(root_child1.getComputedWidth()).toBe(10)
1539
+ expect(root_child1.getComputedHeight()).toBe(100)
1540
+
1541
+ expect(root_child2.getComputedLeft()).toBe(-30)
1542
+ expect(root_child2.getComputedTop()).toBe(0)
1543
+ expect(root_child2.getComputedWidth()).toBe(10)
1544
+ expect(root_child2.getComputedHeight()).toBe(100)
1545
+
1546
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1547
+
1548
+ expect(root.getComputedLeft()).toBe(0)
1549
+ expect(root.getComputedTop()).toBe(0)
1550
+ expect(root.getComputedWidth()).toBe(100)
1551
+ expect(root.getComputedHeight()).toBe(100)
1552
+
1553
+ expect(root_child0.getComputedLeft()).toBe(0)
1554
+ expect(root_child0.getComputedTop()).toBe(0)
1555
+ expect(root_child0.getComputedWidth()).toBe(10)
1556
+ expect(root_child0.getComputedHeight()).toBe(100)
1557
+
1558
+ expect(root_child1.getComputedLeft()).toBe(10)
1559
+ expect(root_child1.getComputedTop()).toBe(0)
1560
+ expect(root_child1.getComputedWidth()).toBe(10)
1561
+ expect(root_child1.getComputedHeight()).toBe(100)
1562
+
1563
+ expect(root_child2.getComputedLeft()).toBe(20)
1564
+ expect(root_child2.getComputedTop()).toBe(0)
1565
+ expect(root_child2.getComputedWidth()).toBe(10)
1566
+ expect(root_child2.getComputedHeight()).toBe(100)
1567
+ } finally {
1568
+ if (typeof root !== "undefined") {
1569
+ root.freeRecursive()
1570
+ }
1571
+
1572
+ config.free()
1573
+ }
1574
+ })
1575
+ test("flex_direction_row_reverse_border_end", () => {
1576
+ const config = Yoga.Config.create()
1577
+ let root
1578
+
1579
+ try {
1580
+ root = Yoga.Node.create(config)
1581
+ root.setFlexDirection(FlexDirection.RowReverse)
1582
+ root.setPositionType(PositionType.Absolute)
1583
+ root.setBorder(Edge.End, 100)
1584
+ root.setWidth(100)
1585
+ root.setHeight(100)
1586
+
1587
+ const root_child0 = Yoga.Node.create(config)
1588
+ root_child0.setWidth(10)
1589
+ root.insertChild(root_child0, 0)
1590
+
1591
+ const root_child1 = Yoga.Node.create(config)
1592
+ root_child1.setWidth(10)
1593
+ root.insertChild(root_child1, 1)
1594
+
1595
+ const root_child2 = Yoga.Node.create(config)
1596
+ root_child2.setWidth(10)
1597
+ root.insertChild(root_child2, 2)
1598
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1599
+
1600
+ expect(root.getComputedLeft()).toBe(0)
1601
+ expect(root.getComputedTop()).toBe(0)
1602
+ expect(root.getComputedWidth()).toBe(100)
1603
+ expect(root.getComputedHeight()).toBe(100)
1604
+
1605
+ expect(root_child0.getComputedLeft()).toBe(-10)
1606
+ expect(root_child0.getComputedTop()).toBe(0)
1607
+ expect(root_child0.getComputedWidth()).toBe(10)
1608
+ expect(root_child0.getComputedHeight()).toBe(100)
1609
+
1610
+ expect(root_child1.getComputedLeft()).toBe(-20)
1611
+ expect(root_child1.getComputedTop()).toBe(0)
1612
+ expect(root_child1.getComputedWidth()).toBe(10)
1613
+ expect(root_child1.getComputedHeight()).toBe(100)
1614
+
1615
+ expect(root_child2.getComputedLeft()).toBe(-30)
1616
+ expect(root_child2.getComputedTop()).toBe(0)
1617
+ expect(root_child2.getComputedWidth()).toBe(10)
1618
+ expect(root_child2.getComputedHeight()).toBe(100)
1619
+
1620
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1621
+
1622
+ expect(root.getComputedLeft()).toBe(0)
1623
+ expect(root.getComputedTop()).toBe(0)
1624
+ expect(root.getComputedWidth()).toBe(100)
1625
+ expect(root.getComputedHeight()).toBe(100)
1626
+
1627
+ expect(root_child0.getComputedLeft()).toBe(100)
1628
+ expect(root_child0.getComputedTop()).toBe(0)
1629
+ expect(root_child0.getComputedWidth()).toBe(10)
1630
+ expect(root_child0.getComputedHeight()).toBe(100)
1631
+
1632
+ expect(root_child1.getComputedLeft()).toBe(110)
1633
+ expect(root_child1.getComputedTop()).toBe(0)
1634
+ expect(root_child1.getComputedWidth()).toBe(10)
1635
+ expect(root_child1.getComputedHeight()).toBe(100)
1636
+
1637
+ expect(root_child2.getComputedLeft()).toBe(120)
1638
+ expect(root_child2.getComputedTop()).toBe(0)
1639
+ expect(root_child2.getComputedWidth()).toBe(10)
1640
+ expect(root_child2.getComputedHeight()).toBe(100)
1641
+ } finally {
1642
+ if (typeof root !== "undefined") {
1643
+ root.freeRecursive()
1644
+ }
1645
+
1646
+ config.free()
1647
+ }
1648
+ })
1649
+ test("flex_direction_column_reverse_border_top", () => {
1650
+ const config = Yoga.Config.create()
1651
+ let root
1652
+
1653
+ try {
1654
+ root = Yoga.Node.create(config)
1655
+ root.setFlexDirection(FlexDirection.ColumnReverse)
1656
+ root.setPositionType(PositionType.Absolute)
1657
+ root.setBorder(Edge.Top, 100)
1658
+ root.setWidth(100)
1659
+ root.setHeight(100)
1660
+
1661
+ const root_child0 = Yoga.Node.create(config)
1662
+ root_child0.setWidth(10)
1663
+ root.insertChild(root_child0, 0)
1664
+
1665
+ const root_child1 = Yoga.Node.create(config)
1666
+ root_child1.setWidth(10)
1667
+ root.insertChild(root_child1, 1)
1668
+
1669
+ const root_child2 = Yoga.Node.create(config)
1670
+ root_child2.setWidth(10)
1671
+ root.insertChild(root_child2, 2)
1672
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1673
+
1674
+ expect(root.getComputedLeft()).toBe(0)
1675
+ expect(root.getComputedTop()).toBe(0)
1676
+ expect(root.getComputedWidth()).toBe(100)
1677
+ expect(root.getComputedHeight()).toBe(100)
1678
+
1679
+ expect(root_child0.getComputedLeft()).toBe(0)
1680
+ expect(root_child0.getComputedTop()).toBe(100)
1681
+ expect(root_child0.getComputedWidth()).toBe(10)
1682
+ expect(root_child0.getComputedHeight()).toBe(0)
1683
+
1684
+ expect(root_child1.getComputedLeft()).toBe(0)
1685
+ expect(root_child1.getComputedTop()).toBe(100)
1686
+ expect(root_child1.getComputedWidth()).toBe(10)
1687
+ expect(root_child1.getComputedHeight()).toBe(0)
1688
+
1689
+ expect(root_child2.getComputedLeft()).toBe(0)
1690
+ expect(root_child2.getComputedTop()).toBe(100)
1691
+ expect(root_child2.getComputedWidth()).toBe(10)
1692
+ expect(root_child2.getComputedHeight()).toBe(0)
1693
+
1694
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1695
+
1696
+ expect(root.getComputedLeft()).toBe(0)
1697
+ expect(root.getComputedTop()).toBe(0)
1698
+ expect(root.getComputedWidth()).toBe(100)
1699
+ expect(root.getComputedHeight()).toBe(100)
1700
+
1701
+ expect(root_child0.getComputedLeft()).toBe(90)
1702
+ expect(root_child0.getComputedTop()).toBe(100)
1703
+ expect(root_child0.getComputedWidth()).toBe(10)
1704
+ expect(root_child0.getComputedHeight()).toBe(0)
1705
+
1706
+ expect(root_child1.getComputedLeft()).toBe(90)
1707
+ expect(root_child1.getComputedTop()).toBe(100)
1708
+ expect(root_child1.getComputedWidth()).toBe(10)
1709
+ expect(root_child1.getComputedHeight()).toBe(0)
1710
+
1711
+ expect(root_child2.getComputedLeft()).toBe(90)
1712
+ expect(root_child2.getComputedTop()).toBe(100)
1713
+ expect(root_child2.getComputedWidth()).toBe(10)
1714
+ expect(root_child2.getComputedHeight()).toBe(0)
1715
+ } finally {
1716
+ if (typeof root !== "undefined") {
1717
+ root.freeRecursive()
1718
+ }
1719
+
1720
+ config.free()
1721
+ }
1722
+ })
1723
+ test("flex_direction_column_reverse_border_bottom", () => {
1724
+ const config = Yoga.Config.create()
1725
+ let root
1726
+
1727
+ try {
1728
+ root = Yoga.Node.create(config)
1729
+ root.setFlexDirection(FlexDirection.ColumnReverse)
1730
+ root.setPositionType(PositionType.Absolute)
1731
+ root.setBorder(Edge.Bottom, 100)
1732
+ root.setWidth(100)
1733
+ root.setHeight(100)
1734
+
1735
+ const root_child0 = Yoga.Node.create(config)
1736
+ root_child0.setWidth(10)
1737
+ root.insertChild(root_child0, 0)
1738
+
1739
+ const root_child1 = Yoga.Node.create(config)
1740
+ root_child1.setWidth(10)
1741
+ root.insertChild(root_child1, 1)
1742
+
1743
+ const root_child2 = Yoga.Node.create(config)
1744
+ root_child2.setWidth(10)
1745
+ root.insertChild(root_child2, 2)
1746
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1747
+
1748
+ expect(root.getComputedLeft()).toBe(0)
1749
+ expect(root.getComputedTop()).toBe(0)
1750
+ expect(root.getComputedWidth()).toBe(100)
1751
+ expect(root.getComputedHeight()).toBe(100)
1752
+
1753
+ expect(root_child0.getComputedLeft()).toBe(0)
1754
+ expect(root_child0.getComputedTop()).toBe(0)
1755
+ expect(root_child0.getComputedWidth()).toBe(10)
1756
+ expect(root_child0.getComputedHeight()).toBe(0)
1757
+
1758
+ expect(root_child1.getComputedLeft()).toBe(0)
1759
+ expect(root_child1.getComputedTop()).toBe(0)
1760
+ expect(root_child1.getComputedWidth()).toBe(10)
1761
+ expect(root_child1.getComputedHeight()).toBe(0)
1762
+
1763
+ expect(root_child2.getComputedLeft()).toBe(0)
1764
+ expect(root_child2.getComputedTop()).toBe(0)
1765
+ expect(root_child2.getComputedWidth()).toBe(10)
1766
+ expect(root_child2.getComputedHeight()).toBe(0)
1767
+
1768
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1769
+
1770
+ expect(root.getComputedLeft()).toBe(0)
1771
+ expect(root.getComputedTop()).toBe(0)
1772
+ expect(root.getComputedWidth()).toBe(100)
1773
+ expect(root.getComputedHeight()).toBe(100)
1774
+
1775
+ expect(root_child0.getComputedLeft()).toBe(90)
1776
+ expect(root_child0.getComputedTop()).toBe(0)
1777
+ expect(root_child0.getComputedWidth()).toBe(10)
1778
+ expect(root_child0.getComputedHeight()).toBe(0)
1779
+
1780
+ expect(root_child1.getComputedLeft()).toBe(90)
1781
+ expect(root_child1.getComputedTop()).toBe(0)
1782
+ expect(root_child1.getComputedWidth()).toBe(10)
1783
+ expect(root_child1.getComputedHeight()).toBe(0)
1784
+
1785
+ expect(root_child2.getComputedLeft()).toBe(90)
1786
+ expect(root_child2.getComputedTop()).toBe(0)
1787
+ expect(root_child2.getComputedWidth()).toBe(10)
1788
+ expect(root_child2.getComputedHeight()).toBe(0)
1789
+ } finally {
1790
+ if (typeof root !== "undefined") {
1791
+ root.freeRecursive()
1792
+ }
1793
+
1794
+ config.free()
1795
+ }
1796
+ })
1797
+ test("flex_direction_row_reverse_pos_left", () => {
1798
+ const config = Yoga.Config.create()
1799
+ let root
1800
+
1801
+ try {
1802
+ root = Yoga.Node.create(config)
1803
+ root.setPositionType(PositionType.Absolute)
1804
+ root.setWidth(100)
1805
+ root.setHeight(100)
1806
+
1807
+ const root_child0 = Yoga.Node.create(config)
1808
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
1809
+ root_child0.setPosition(Edge.Left, 100)
1810
+ root_child0.setWidth(100)
1811
+ root_child0.setHeight(100)
1812
+ root.insertChild(root_child0, 0)
1813
+
1814
+ const root_child0_child0 = Yoga.Node.create(config)
1815
+ root_child0_child0.setWidth(10)
1816
+ root_child0.insertChild(root_child0_child0, 0)
1817
+
1818
+ const root_child0_child1 = Yoga.Node.create(config)
1819
+ root_child0_child1.setWidth(10)
1820
+ root_child0.insertChild(root_child0_child1, 1)
1821
+
1822
+ const root_child0_child2 = Yoga.Node.create(config)
1823
+ root_child0_child2.setWidth(10)
1824
+ root_child0.insertChild(root_child0_child2, 2)
1825
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1826
+
1827
+ expect(root.getComputedLeft()).toBe(0)
1828
+ expect(root.getComputedTop()).toBe(0)
1829
+ expect(root.getComputedWidth()).toBe(100)
1830
+ expect(root.getComputedHeight()).toBe(100)
1831
+
1832
+ expect(root_child0.getComputedLeft()).toBe(100)
1833
+ expect(root_child0.getComputedTop()).toBe(0)
1834
+ expect(root_child0.getComputedWidth()).toBe(100)
1835
+ expect(root_child0.getComputedHeight()).toBe(100)
1836
+
1837
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
1838
+ expect(root_child0_child0.getComputedTop()).toBe(0)
1839
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
1840
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
1841
+
1842
+ expect(root_child0_child1.getComputedLeft()).toBe(80)
1843
+ expect(root_child0_child1.getComputedTop()).toBe(0)
1844
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
1845
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
1846
+
1847
+ expect(root_child0_child2.getComputedLeft()).toBe(70)
1848
+ expect(root_child0_child2.getComputedTop()).toBe(0)
1849
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
1850
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
1851
+
1852
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1853
+
1854
+ expect(root.getComputedLeft()).toBe(0)
1855
+ expect(root.getComputedTop()).toBe(0)
1856
+ expect(root.getComputedWidth()).toBe(100)
1857
+ expect(root.getComputedHeight()).toBe(100)
1858
+
1859
+ expect(root_child0.getComputedLeft()).toBe(100)
1860
+ expect(root_child0.getComputedTop()).toBe(0)
1861
+ expect(root_child0.getComputedWidth()).toBe(100)
1862
+ expect(root_child0.getComputedHeight()).toBe(100)
1863
+
1864
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
1865
+ expect(root_child0_child0.getComputedTop()).toBe(0)
1866
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
1867
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
1868
+
1869
+ expect(root_child0_child1.getComputedLeft()).toBe(10)
1870
+ expect(root_child0_child1.getComputedTop()).toBe(0)
1871
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
1872
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
1873
+
1874
+ expect(root_child0_child2.getComputedLeft()).toBe(20)
1875
+ expect(root_child0_child2.getComputedTop()).toBe(0)
1876
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
1877
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
1878
+ } finally {
1879
+ if (typeof root !== "undefined") {
1880
+ root.freeRecursive()
1881
+ }
1882
+
1883
+ config.free()
1884
+ }
1885
+ })
1886
+ test("flex_direction_row_reverse_pos_start", () => {
1887
+ const config = Yoga.Config.create()
1888
+ let root
1889
+
1890
+ try {
1891
+ root = Yoga.Node.create(config)
1892
+ root.setPositionType(PositionType.Absolute)
1893
+ root.setWidth(100)
1894
+ root.setHeight(100)
1895
+
1896
+ const root_child0 = Yoga.Node.create(config)
1897
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
1898
+ root_child0.setPosition(Edge.Start, 100)
1899
+ root_child0.setWidth(100)
1900
+ root_child0.setHeight(100)
1901
+ root.insertChild(root_child0, 0)
1902
+
1903
+ const root_child0_child0 = Yoga.Node.create(config)
1904
+ root_child0_child0.setWidth(10)
1905
+ root_child0.insertChild(root_child0_child0, 0)
1906
+
1907
+ const root_child0_child1 = Yoga.Node.create(config)
1908
+ root_child0_child1.setWidth(10)
1909
+ root_child0.insertChild(root_child0_child1, 1)
1910
+
1911
+ const root_child0_child2 = Yoga.Node.create(config)
1912
+ root_child0_child2.setWidth(10)
1913
+ root_child0.insertChild(root_child0_child2, 2)
1914
+ root.calculateLayout(undefined, undefined, Direction.LTR)
1915
+
1916
+ expect(root.getComputedLeft()).toBe(0)
1917
+ expect(root.getComputedTop()).toBe(0)
1918
+ expect(root.getComputedWidth()).toBe(100)
1919
+ expect(root.getComputedHeight()).toBe(100)
1920
+
1921
+ expect(root_child0.getComputedLeft()).toBe(100)
1922
+ expect(root_child0.getComputedTop()).toBe(0)
1923
+ expect(root_child0.getComputedWidth()).toBe(100)
1924
+ expect(root_child0.getComputedHeight()).toBe(100)
1925
+
1926
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
1927
+ expect(root_child0_child0.getComputedTop()).toBe(0)
1928
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
1929
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
1930
+
1931
+ expect(root_child0_child1.getComputedLeft()).toBe(80)
1932
+ expect(root_child0_child1.getComputedTop()).toBe(0)
1933
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
1934
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
1935
+
1936
+ expect(root_child0_child2.getComputedLeft()).toBe(70)
1937
+ expect(root_child0_child2.getComputedTop()).toBe(0)
1938
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
1939
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
1940
+
1941
+ root.calculateLayout(undefined, undefined, Direction.RTL)
1942
+
1943
+ expect(root.getComputedLeft()).toBe(0)
1944
+ expect(root.getComputedTop()).toBe(0)
1945
+ expect(root.getComputedWidth()).toBe(100)
1946
+ expect(root.getComputedHeight()).toBe(100)
1947
+
1948
+ expect(root_child0.getComputedLeft()).toBe(-100)
1949
+ expect(root_child0.getComputedTop()).toBe(0)
1950
+ expect(root_child0.getComputedWidth()).toBe(100)
1951
+ expect(root_child0.getComputedHeight()).toBe(100)
1952
+
1953
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
1954
+ expect(root_child0_child0.getComputedTop()).toBe(0)
1955
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
1956
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
1957
+
1958
+ expect(root_child0_child1.getComputedLeft()).toBe(10)
1959
+ expect(root_child0_child1.getComputedTop()).toBe(0)
1960
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
1961
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
1962
+
1963
+ expect(root_child0_child2.getComputedLeft()).toBe(20)
1964
+ expect(root_child0_child2.getComputedTop()).toBe(0)
1965
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
1966
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
1967
+ } finally {
1968
+ if (typeof root !== "undefined") {
1969
+ root.freeRecursive()
1970
+ }
1971
+
1972
+ config.free()
1973
+ }
1974
+ })
1975
+ test("flex_direction_row_reverse_pos_right", () => {
1976
+ const config = Yoga.Config.create()
1977
+ let root
1978
+
1979
+ try {
1980
+ root = Yoga.Node.create(config)
1981
+ root.setPositionType(PositionType.Absolute)
1982
+ root.setWidth(100)
1983
+ root.setHeight(100)
1984
+
1985
+ const root_child0 = Yoga.Node.create(config)
1986
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
1987
+ root_child0.setPosition(Edge.Right, 100)
1988
+ root_child0.setWidth(100)
1989
+ root_child0.setHeight(100)
1990
+ root.insertChild(root_child0, 0)
1991
+
1992
+ const root_child0_child0 = Yoga.Node.create(config)
1993
+ root_child0_child0.setWidth(10)
1994
+ root_child0.insertChild(root_child0_child0, 0)
1995
+
1996
+ const root_child0_child1 = Yoga.Node.create(config)
1997
+ root_child0_child1.setWidth(10)
1998
+ root_child0.insertChild(root_child0_child1, 1)
1999
+
2000
+ const root_child0_child2 = Yoga.Node.create(config)
2001
+ root_child0_child2.setWidth(10)
2002
+ root_child0.insertChild(root_child0_child2, 2)
2003
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2004
+
2005
+ expect(root.getComputedLeft()).toBe(0)
2006
+ expect(root.getComputedTop()).toBe(0)
2007
+ expect(root.getComputedWidth()).toBe(100)
2008
+ expect(root.getComputedHeight()).toBe(100)
2009
+
2010
+ expect(root_child0.getComputedLeft()).toBe(-100)
2011
+ expect(root_child0.getComputedTop()).toBe(0)
2012
+ expect(root_child0.getComputedWidth()).toBe(100)
2013
+ expect(root_child0.getComputedHeight()).toBe(100)
2014
+
2015
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2016
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2017
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2018
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
2019
+
2020
+ expect(root_child0_child1.getComputedLeft()).toBe(80)
2021
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2022
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2023
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2024
+
2025
+ expect(root_child0_child2.getComputedLeft()).toBe(70)
2026
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2027
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2028
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2029
+
2030
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2031
+
2032
+ expect(root.getComputedLeft()).toBe(0)
2033
+ expect(root.getComputedTop()).toBe(0)
2034
+ expect(root.getComputedWidth()).toBe(100)
2035
+ expect(root.getComputedHeight()).toBe(100)
2036
+
2037
+ expect(root_child0.getComputedLeft()).toBe(-100)
2038
+ expect(root_child0.getComputedTop()).toBe(0)
2039
+ expect(root_child0.getComputedWidth()).toBe(100)
2040
+ expect(root_child0.getComputedHeight()).toBe(100)
2041
+
2042
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
2043
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2044
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2045
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
2046
+
2047
+ expect(root_child0_child1.getComputedLeft()).toBe(10)
2048
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2049
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2050
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2051
+
2052
+ expect(root_child0_child2.getComputedLeft()).toBe(20)
2053
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2054
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2055
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2056
+ } finally {
2057
+ if (typeof root !== "undefined") {
2058
+ root.freeRecursive()
2059
+ }
2060
+
2061
+ config.free()
2062
+ }
2063
+ })
2064
+ test("flex_direction_row_reverse_pos_end", () => {
2065
+ const config = Yoga.Config.create()
2066
+ let root
2067
+
2068
+ try {
2069
+ root = Yoga.Node.create(config)
2070
+ root.setPositionType(PositionType.Absolute)
2071
+ root.setWidth(100)
2072
+ root.setHeight(100)
2073
+
2074
+ const root_child0 = Yoga.Node.create(config)
2075
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2076
+ root_child0.setPosition(Edge.End, 100)
2077
+ root_child0.setWidth(100)
2078
+ root_child0.setHeight(100)
2079
+ root.insertChild(root_child0, 0)
2080
+
2081
+ const root_child0_child0 = Yoga.Node.create(config)
2082
+ root_child0_child0.setWidth(10)
2083
+ root_child0.insertChild(root_child0_child0, 0)
2084
+
2085
+ const root_child0_child1 = Yoga.Node.create(config)
2086
+ root_child0_child1.setWidth(10)
2087
+ root_child0.insertChild(root_child0_child1, 1)
2088
+
2089
+ const root_child0_child2 = Yoga.Node.create(config)
2090
+ root_child0_child2.setWidth(10)
2091
+ root_child0.insertChild(root_child0_child2, 2)
2092
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2093
+
2094
+ expect(root.getComputedLeft()).toBe(0)
2095
+ expect(root.getComputedTop()).toBe(0)
2096
+ expect(root.getComputedWidth()).toBe(100)
2097
+ expect(root.getComputedHeight()).toBe(100)
2098
+
2099
+ expect(root_child0.getComputedLeft()).toBe(-100)
2100
+ expect(root_child0.getComputedTop()).toBe(0)
2101
+ expect(root_child0.getComputedWidth()).toBe(100)
2102
+ expect(root_child0.getComputedHeight()).toBe(100)
2103
+
2104
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2105
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2106
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2107
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
2108
+
2109
+ expect(root_child0_child1.getComputedLeft()).toBe(80)
2110
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2111
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2112
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2113
+
2114
+ expect(root_child0_child2.getComputedLeft()).toBe(70)
2115
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2116
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2117
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2118
+
2119
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2120
+
2121
+ expect(root.getComputedLeft()).toBe(0)
2122
+ expect(root.getComputedTop()).toBe(0)
2123
+ expect(root.getComputedWidth()).toBe(100)
2124
+ expect(root.getComputedHeight()).toBe(100)
2125
+
2126
+ expect(root_child0.getComputedLeft()).toBe(100)
2127
+ expect(root_child0.getComputedTop()).toBe(0)
2128
+ expect(root_child0.getComputedWidth()).toBe(100)
2129
+ expect(root_child0.getComputedHeight()).toBe(100)
2130
+
2131
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
2132
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2133
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2134
+ expect(root_child0_child0.getComputedHeight()).toBe(100)
2135
+
2136
+ expect(root_child0_child1.getComputedLeft()).toBe(10)
2137
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2138
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2139
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2140
+
2141
+ expect(root_child0_child2.getComputedLeft()).toBe(20)
2142
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2143
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2144
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2145
+ } finally {
2146
+ if (typeof root !== "undefined") {
2147
+ root.freeRecursive()
2148
+ }
2149
+
2150
+ config.free()
2151
+ }
2152
+ })
2153
+ test("flex_direction_column_reverse_pos_top", () => {
2154
+ const config = Yoga.Config.create()
2155
+ let root
2156
+
2157
+ try {
2158
+ root = Yoga.Node.create(config)
2159
+ root.setPositionType(PositionType.Absolute)
2160
+ root.setWidth(100)
2161
+ root.setHeight(100)
2162
+
2163
+ const root_child0 = Yoga.Node.create(config)
2164
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
2165
+ root_child0.setPosition(Edge.Top, 100)
2166
+ root_child0.setWidth(100)
2167
+ root_child0.setHeight(100)
2168
+ root.insertChild(root_child0, 0)
2169
+
2170
+ const root_child0_child0 = Yoga.Node.create(config)
2171
+ root_child0_child0.setWidth(10)
2172
+ root_child0.insertChild(root_child0_child0, 0)
2173
+
2174
+ const root_child0_child1 = Yoga.Node.create(config)
2175
+ root_child0_child1.setWidth(10)
2176
+ root_child0.insertChild(root_child0_child1, 1)
2177
+
2178
+ const root_child0_child2 = Yoga.Node.create(config)
2179
+ root_child0_child2.setWidth(10)
2180
+ root_child0.insertChild(root_child0_child2, 2)
2181
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2182
+
2183
+ expect(root.getComputedLeft()).toBe(0)
2184
+ expect(root.getComputedTop()).toBe(0)
2185
+ expect(root.getComputedWidth()).toBe(100)
2186
+ expect(root.getComputedHeight()).toBe(100)
2187
+
2188
+ expect(root_child0.getComputedLeft()).toBe(0)
2189
+ expect(root_child0.getComputedTop()).toBe(100)
2190
+ expect(root_child0.getComputedWidth()).toBe(100)
2191
+ expect(root_child0.getComputedHeight()).toBe(100)
2192
+
2193
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
2194
+ expect(root_child0_child0.getComputedTop()).toBe(100)
2195
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2196
+ expect(root_child0_child0.getComputedHeight()).toBe(0)
2197
+
2198
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2199
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2200
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2201
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2202
+
2203
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
2204
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2205
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2206
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2207
+
2208
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2209
+
2210
+ expect(root.getComputedLeft()).toBe(0)
2211
+ expect(root.getComputedTop()).toBe(0)
2212
+ expect(root.getComputedWidth()).toBe(100)
2213
+ expect(root.getComputedHeight()).toBe(100)
2214
+
2215
+ expect(root_child0.getComputedLeft()).toBe(0)
2216
+ expect(root_child0.getComputedTop()).toBe(100)
2217
+ expect(root_child0.getComputedWidth()).toBe(100)
2218
+ expect(root_child0.getComputedHeight()).toBe(100)
2219
+
2220
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2221
+ expect(root_child0_child0.getComputedTop()).toBe(100)
2222
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2223
+ expect(root_child0_child0.getComputedHeight()).toBe(0)
2224
+
2225
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2226
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2227
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2228
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2229
+
2230
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
2231
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2232
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2233
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2234
+ } finally {
2235
+ if (typeof root !== "undefined") {
2236
+ root.freeRecursive()
2237
+ }
2238
+
2239
+ config.free()
2240
+ }
2241
+ })
2242
+ test("flex_direction_column_reverse_pos_bottom", () => {
2243
+ const config = Yoga.Config.create()
2244
+ let root
2245
+
2246
+ try {
2247
+ root = Yoga.Node.create(config)
2248
+ root.setPositionType(PositionType.Absolute)
2249
+ root.setWidth(100)
2250
+ root.setHeight(100)
2251
+
2252
+ const root_child0 = Yoga.Node.create(config)
2253
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
2254
+ root_child0.setPosition(Edge.Bottom, 100)
2255
+ root_child0.setWidth(100)
2256
+ root_child0.setHeight(100)
2257
+ root.insertChild(root_child0, 0)
2258
+
2259
+ const root_child0_child0 = Yoga.Node.create(config)
2260
+ root_child0_child0.setWidth(10)
2261
+ root_child0.insertChild(root_child0_child0, 0)
2262
+
2263
+ const root_child0_child1 = Yoga.Node.create(config)
2264
+ root_child0_child1.setWidth(10)
2265
+ root_child0.insertChild(root_child0_child1, 1)
2266
+
2267
+ const root_child0_child2 = Yoga.Node.create(config)
2268
+ root_child0_child2.setWidth(10)
2269
+ root_child0.insertChild(root_child0_child2, 2)
2270
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2271
+
2272
+ expect(root.getComputedLeft()).toBe(0)
2273
+ expect(root.getComputedTop()).toBe(0)
2274
+ expect(root.getComputedWidth()).toBe(100)
2275
+ expect(root.getComputedHeight()).toBe(100)
2276
+
2277
+ expect(root_child0.getComputedLeft()).toBe(0)
2278
+ expect(root_child0.getComputedTop()).toBe(-100)
2279
+ expect(root_child0.getComputedWidth()).toBe(100)
2280
+ expect(root_child0.getComputedHeight()).toBe(100)
2281
+
2282
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
2283
+ expect(root_child0_child0.getComputedTop()).toBe(100)
2284
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2285
+ expect(root_child0_child0.getComputedHeight()).toBe(0)
2286
+
2287
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2288
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2289
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2290
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2291
+
2292
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
2293
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2294
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2295
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2296
+
2297
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2298
+
2299
+ expect(root.getComputedLeft()).toBe(0)
2300
+ expect(root.getComputedTop()).toBe(0)
2301
+ expect(root.getComputedWidth()).toBe(100)
2302
+ expect(root.getComputedHeight()).toBe(100)
2303
+
2304
+ expect(root_child0.getComputedLeft()).toBe(0)
2305
+ expect(root_child0.getComputedTop()).toBe(-100)
2306
+ expect(root_child0.getComputedWidth()).toBe(100)
2307
+ expect(root_child0.getComputedHeight()).toBe(100)
2308
+
2309
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2310
+ expect(root_child0_child0.getComputedTop()).toBe(100)
2311
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2312
+ expect(root_child0_child0.getComputedHeight()).toBe(0)
2313
+
2314
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2315
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2316
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2317
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2318
+
2319
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
2320
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2321
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2322
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2323
+ } finally {
2324
+ if (typeof root !== "undefined") {
2325
+ root.freeRecursive()
2326
+ }
2327
+
2328
+ config.free()
2329
+ }
2330
+ })
2331
+ test("flex_direction_row_reverse_inner_pos_left", () => {
2332
+ const config = Yoga.Config.create()
2333
+ let root
2334
+
2335
+ try {
2336
+ root = Yoga.Node.create(config)
2337
+ root.setPositionType(PositionType.Absolute)
2338
+ root.setWidth(100)
2339
+ root.setHeight(100)
2340
+
2341
+ const root_child0 = Yoga.Node.create(config)
2342
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2343
+ root_child0.setWidth(100)
2344
+ root_child0.setHeight(100)
2345
+ root.insertChild(root_child0, 0)
2346
+
2347
+ const root_child0_child0 = Yoga.Node.create(config)
2348
+ root_child0_child0.setPositionType(PositionType.Absolute)
2349
+ root_child0_child0.setPosition(Edge.Left, 10)
2350
+ root_child0_child0.setWidth(10)
2351
+ root_child0_child0.setHeight(10)
2352
+ root_child0.insertChild(root_child0_child0, 0)
2353
+
2354
+ const root_child0_child1 = Yoga.Node.create(config)
2355
+ root_child0_child1.setWidth(10)
2356
+ root_child0.insertChild(root_child0_child1, 1)
2357
+
2358
+ const root_child0_child2 = Yoga.Node.create(config)
2359
+ root_child0_child2.setWidth(10)
2360
+ root_child0.insertChild(root_child0_child2, 2)
2361
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2362
+
2363
+ expect(root.getComputedLeft()).toBe(0)
2364
+ expect(root.getComputedTop()).toBe(0)
2365
+ expect(root.getComputedWidth()).toBe(100)
2366
+ expect(root.getComputedHeight()).toBe(100)
2367
+
2368
+ expect(root_child0.getComputedLeft()).toBe(0)
2369
+ expect(root_child0.getComputedTop()).toBe(0)
2370
+ expect(root_child0.getComputedWidth()).toBe(100)
2371
+ expect(root_child0.getComputedHeight()).toBe(100)
2372
+
2373
+ expect(root_child0_child0.getComputedLeft()).toBe(10)
2374
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2375
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2376
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2377
+
2378
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2379
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2380
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2381
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2382
+
2383
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
2384
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2385
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2386
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2387
+
2388
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2389
+
2390
+ expect(root.getComputedLeft()).toBe(0)
2391
+ expect(root.getComputedTop()).toBe(0)
2392
+ expect(root.getComputedWidth()).toBe(100)
2393
+ expect(root.getComputedHeight()).toBe(100)
2394
+
2395
+ expect(root_child0.getComputedLeft()).toBe(0)
2396
+ expect(root_child0.getComputedTop()).toBe(0)
2397
+ expect(root_child0.getComputedWidth()).toBe(100)
2398
+ expect(root_child0.getComputedHeight()).toBe(100)
2399
+
2400
+ expect(root_child0_child0.getComputedLeft()).toBe(10)
2401
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2402
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2403
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2404
+
2405
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2406
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2407
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2408
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2409
+
2410
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
2411
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2412
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2413
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2414
+ } finally {
2415
+ if (typeof root !== "undefined") {
2416
+ root.freeRecursive()
2417
+ }
2418
+
2419
+ config.free()
2420
+ }
2421
+ })
2422
+ test("flex_direction_row_reverse_inner_pos_right", () => {
2423
+ const config = Yoga.Config.create()
2424
+ let root
2425
+
2426
+ try {
2427
+ root = Yoga.Node.create(config)
2428
+ root.setPositionType(PositionType.Absolute)
2429
+ root.setWidth(100)
2430
+ root.setHeight(100)
2431
+
2432
+ const root_child0 = Yoga.Node.create(config)
2433
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2434
+ root_child0.setWidth(100)
2435
+ root_child0.setHeight(100)
2436
+ root.insertChild(root_child0, 0)
2437
+
2438
+ const root_child0_child0 = Yoga.Node.create(config)
2439
+ root_child0_child0.setPositionType(PositionType.Absolute)
2440
+ root_child0_child0.setPosition(Edge.Right, 10)
2441
+ root_child0_child0.setWidth(10)
2442
+ root_child0_child0.setHeight(10)
2443
+ root_child0.insertChild(root_child0_child0, 0)
2444
+
2445
+ const root_child0_child1 = Yoga.Node.create(config)
2446
+ root_child0_child1.setWidth(10)
2447
+ root_child0.insertChild(root_child0_child1, 1)
2448
+
2449
+ const root_child0_child2 = Yoga.Node.create(config)
2450
+ root_child0_child2.setWidth(10)
2451
+ root_child0.insertChild(root_child0_child2, 2)
2452
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2453
+
2454
+ expect(root.getComputedLeft()).toBe(0)
2455
+ expect(root.getComputedTop()).toBe(0)
2456
+ expect(root.getComputedWidth()).toBe(100)
2457
+ expect(root.getComputedHeight()).toBe(100)
2458
+
2459
+ expect(root_child0.getComputedLeft()).toBe(0)
2460
+ expect(root_child0.getComputedTop()).toBe(0)
2461
+ expect(root_child0.getComputedWidth()).toBe(100)
2462
+ expect(root_child0.getComputedHeight()).toBe(100)
2463
+
2464
+ expect(root_child0_child0.getComputedLeft()).toBe(80)
2465
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2466
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2467
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2468
+
2469
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2470
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2471
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2472
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2473
+
2474
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
2475
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2476
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2477
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2478
+
2479
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2480
+
2481
+ expect(root.getComputedLeft()).toBe(0)
2482
+ expect(root.getComputedTop()).toBe(0)
2483
+ expect(root.getComputedWidth()).toBe(100)
2484
+ expect(root.getComputedHeight()).toBe(100)
2485
+
2486
+ expect(root_child0.getComputedLeft()).toBe(0)
2487
+ expect(root_child0.getComputedTop()).toBe(0)
2488
+ expect(root_child0.getComputedWidth()).toBe(100)
2489
+ expect(root_child0.getComputedHeight()).toBe(100)
2490
+
2491
+ expect(root_child0_child0.getComputedLeft()).toBe(80)
2492
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2493
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2494
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2495
+
2496
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2497
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2498
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2499
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2500
+
2501
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
2502
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2503
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2504
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2505
+ } finally {
2506
+ if (typeof root !== "undefined") {
2507
+ root.freeRecursive()
2508
+ }
2509
+
2510
+ config.free()
2511
+ }
2512
+ })
2513
+ test("flex_direction_col_reverse_inner_pos_top", () => {
2514
+ const config = Yoga.Config.create()
2515
+ let root
2516
+
2517
+ try {
2518
+ root = Yoga.Node.create(config)
2519
+ root.setPositionType(PositionType.Absolute)
2520
+ root.setWidth(100)
2521
+ root.setHeight(100)
2522
+
2523
+ const root_child0 = Yoga.Node.create(config)
2524
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
2525
+ root_child0.setWidth(100)
2526
+ root_child0.setHeight(100)
2527
+ root.insertChild(root_child0, 0)
2528
+
2529
+ const root_child0_child0 = Yoga.Node.create(config)
2530
+ root_child0_child0.setPositionType(PositionType.Absolute)
2531
+ root_child0_child0.setPosition(Edge.Top, 10)
2532
+ root_child0_child0.setWidth(10)
2533
+ root_child0_child0.setHeight(10)
2534
+ root_child0.insertChild(root_child0_child0, 0)
2535
+
2536
+ const root_child0_child1 = Yoga.Node.create(config)
2537
+ root_child0_child1.setWidth(10)
2538
+ root_child0.insertChild(root_child0_child1, 1)
2539
+
2540
+ const root_child0_child2 = Yoga.Node.create(config)
2541
+ root_child0_child2.setWidth(10)
2542
+ root_child0.insertChild(root_child0_child2, 2)
2543
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2544
+
2545
+ expect(root.getComputedLeft()).toBe(0)
2546
+ expect(root.getComputedTop()).toBe(0)
2547
+ expect(root.getComputedWidth()).toBe(100)
2548
+ expect(root.getComputedHeight()).toBe(100)
2549
+
2550
+ expect(root_child0.getComputedLeft()).toBe(0)
2551
+ expect(root_child0.getComputedTop()).toBe(0)
2552
+ expect(root_child0.getComputedWidth()).toBe(100)
2553
+ expect(root_child0.getComputedHeight()).toBe(100)
2554
+
2555
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
2556
+ expect(root_child0_child0.getComputedTop()).toBe(10)
2557
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2558
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2559
+
2560
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2561
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2562
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2563
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2564
+
2565
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
2566
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2567
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2568
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2569
+
2570
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2571
+
2572
+ expect(root.getComputedLeft()).toBe(0)
2573
+ expect(root.getComputedTop()).toBe(0)
2574
+ expect(root.getComputedWidth()).toBe(100)
2575
+ expect(root.getComputedHeight()).toBe(100)
2576
+
2577
+ expect(root_child0.getComputedLeft()).toBe(0)
2578
+ expect(root_child0.getComputedTop()).toBe(0)
2579
+ expect(root_child0.getComputedWidth()).toBe(100)
2580
+ expect(root_child0.getComputedHeight()).toBe(100)
2581
+
2582
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2583
+ expect(root_child0_child0.getComputedTop()).toBe(10)
2584
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2585
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2586
+
2587
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2588
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2589
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2590
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2591
+
2592
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
2593
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2594
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2595
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2596
+ } finally {
2597
+ if (typeof root !== "undefined") {
2598
+ root.freeRecursive()
2599
+ }
2600
+
2601
+ config.free()
2602
+ }
2603
+ })
2604
+ test("flex_direction_col_reverse_inner_pos_bottom", () => {
2605
+ const config = Yoga.Config.create()
2606
+ let root
2607
+
2608
+ try {
2609
+ root = Yoga.Node.create(config)
2610
+ root.setPositionType(PositionType.Absolute)
2611
+ root.setWidth(100)
2612
+ root.setHeight(100)
2613
+
2614
+ const root_child0 = Yoga.Node.create(config)
2615
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
2616
+ root_child0.setWidth(100)
2617
+ root_child0.setHeight(100)
2618
+ root.insertChild(root_child0, 0)
2619
+
2620
+ const root_child0_child0 = Yoga.Node.create(config)
2621
+ root_child0_child0.setPositionType(PositionType.Absolute)
2622
+ root_child0_child0.setPosition(Edge.Bottom, 10)
2623
+ root_child0_child0.setWidth(10)
2624
+ root_child0_child0.setHeight(10)
2625
+ root_child0.insertChild(root_child0_child0, 0)
2626
+
2627
+ const root_child0_child1 = Yoga.Node.create(config)
2628
+ root_child0_child1.setWidth(10)
2629
+ root_child0.insertChild(root_child0_child1, 1)
2630
+
2631
+ const root_child0_child2 = Yoga.Node.create(config)
2632
+ root_child0_child2.setWidth(10)
2633
+ root_child0.insertChild(root_child0_child2, 2)
2634
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2635
+
2636
+ expect(root.getComputedLeft()).toBe(0)
2637
+ expect(root.getComputedTop()).toBe(0)
2638
+ expect(root.getComputedWidth()).toBe(100)
2639
+ expect(root.getComputedHeight()).toBe(100)
2640
+
2641
+ expect(root_child0.getComputedLeft()).toBe(0)
2642
+ expect(root_child0.getComputedTop()).toBe(0)
2643
+ expect(root_child0.getComputedWidth()).toBe(100)
2644
+ expect(root_child0.getComputedHeight()).toBe(100)
2645
+
2646
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
2647
+ expect(root_child0_child0.getComputedTop()).toBe(80)
2648
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2649
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2650
+
2651
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2652
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2653
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2654
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2655
+
2656
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
2657
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2658
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2659
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2660
+
2661
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2662
+
2663
+ expect(root.getComputedLeft()).toBe(0)
2664
+ expect(root.getComputedTop()).toBe(0)
2665
+ expect(root.getComputedWidth()).toBe(100)
2666
+ expect(root.getComputedHeight()).toBe(100)
2667
+
2668
+ expect(root_child0.getComputedLeft()).toBe(0)
2669
+ expect(root_child0.getComputedTop()).toBe(0)
2670
+ expect(root_child0.getComputedWidth()).toBe(100)
2671
+ expect(root_child0.getComputedHeight()).toBe(100)
2672
+
2673
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2674
+ expect(root_child0_child0.getComputedTop()).toBe(80)
2675
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2676
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2677
+
2678
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2679
+ expect(root_child0_child1.getComputedTop()).toBe(100)
2680
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2681
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
2682
+
2683
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
2684
+ expect(root_child0_child2.getComputedTop()).toBe(100)
2685
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2686
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
2687
+ } finally {
2688
+ if (typeof root !== "undefined") {
2689
+ root.freeRecursive()
2690
+ }
2691
+
2692
+ config.free()
2693
+ }
2694
+ })
2695
+ test.skip("flex_direction_row_reverse_inner_pos_start", () => {
2696
+ const config = Yoga.Config.create()
2697
+ let root
2698
+
2699
+ try {
2700
+ root = Yoga.Node.create(config)
2701
+ root.setPositionType(PositionType.Absolute)
2702
+ root.setWidth(100)
2703
+ root.setHeight(100)
2704
+
2705
+ const root_child0 = Yoga.Node.create(config)
2706
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2707
+ root_child0.setWidth(100)
2708
+ root_child0.setHeight(100)
2709
+ root.insertChild(root_child0, 0)
2710
+
2711
+ const root_child0_child0 = Yoga.Node.create(config)
2712
+ root_child0_child0.setPositionType(PositionType.Absolute)
2713
+ root_child0_child0.setPosition(Edge.Start, 10)
2714
+ root_child0_child0.setWidth(10)
2715
+ root_child0_child0.setHeight(10)
2716
+ root_child0.insertChild(root_child0_child0, 0)
2717
+
2718
+ const root_child0_child1 = Yoga.Node.create(config)
2719
+ root_child0_child1.setWidth(10)
2720
+ root_child0.insertChild(root_child0_child1, 1)
2721
+
2722
+ const root_child0_child2 = Yoga.Node.create(config)
2723
+ root_child0_child2.setWidth(10)
2724
+ root_child0.insertChild(root_child0_child2, 2)
2725
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2726
+
2727
+ expect(root.getComputedLeft()).toBe(0)
2728
+ expect(root.getComputedTop()).toBe(0)
2729
+ expect(root.getComputedWidth()).toBe(100)
2730
+ expect(root.getComputedHeight()).toBe(100)
2731
+
2732
+ expect(root_child0.getComputedLeft()).toBe(0)
2733
+ expect(root_child0.getComputedTop()).toBe(0)
2734
+ expect(root_child0.getComputedWidth()).toBe(100)
2735
+ expect(root_child0.getComputedHeight()).toBe(100)
2736
+
2737
+ expect(root_child0_child0.getComputedLeft()).toBe(10)
2738
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2739
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2740
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2741
+
2742
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2743
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2744
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2745
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2746
+
2747
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
2748
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2749
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2750
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2751
+
2752
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2753
+
2754
+ expect(root.getComputedLeft()).toBe(0)
2755
+ expect(root.getComputedTop()).toBe(0)
2756
+ expect(root.getComputedWidth()).toBe(100)
2757
+ expect(root.getComputedHeight()).toBe(100)
2758
+
2759
+ expect(root_child0.getComputedLeft()).toBe(0)
2760
+ expect(root_child0.getComputedTop()).toBe(0)
2761
+ expect(root_child0.getComputedWidth()).toBe(100)
2762
+ expect(root_child0.getComputedHeight()).toBe(100)
2763
+
2764
+ expect(root_child0_child0.getComputedLeft()).toBe(80)
2765
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2766
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2767
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2768
+
2769
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2770
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2771
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2772
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2773
+
2774
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
2775
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2776
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2777
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2778
+ } finally {
2779
+ if (typeof root !== "undefined") {
2780
+ root.freeRecursive()
2781
+ }
2782
+
2783
+ config.free()
2784
+ }
2785
+ })
2786
+ test.skip("flex_direction_row_reverse_inner_pos_end", () => {
2787
+ const config = Yoga.Config.create()
2788
+ let root
2789
+
2790
+ try {
2791
+ root = Yoga.Node.create(config)
2792
+ root.setPositionType(PositionType.Absolute)
2793
+ root.setWidth(100)
2794
+ root.setHeight(100)
2795
+
2796
+ const root_child0 = Yoga.Node.create(config)
2797
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2798
+ root_child0.setWidth(100)
2799
+ root_child0.setHeight(100)
2800
+ root.insertChild(root_child0, 0)
2801
+
2802
+ const root_child0_child0 = Yoga.Node.create(config)
2803
+ root_child0_child0.setPositionType(PositionType.Absolute)
2804
+ root_child0_child0.setPosition(Edge.End, 10)
2805
+ root_child0_child0.setWidth(10)
2806
+ root_child0_child0.setHeight(10)
2807
+ root_child0.insertChild(root_child0_child0, 0)
2808
+
2809
+ const root_child0_child1 = Yoga.Node.create(config)
2810
+ root_child0_child1.setWidth(10)
2811
+ root_child0.insertChild(root_child0_child1, 1)
2812
+
2813
+ const root_child0_child2 = Yoga.Node.create(config)
2814
+ root_child0_child2.setWidth(10)
2815
+ root_child0.insertChild(root_child0_child2, 2)
2816
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2817
+
2818
+ expect(root.getComputedLeft()).toBe(0)
2819
+ expect(root.getComputedTop()).toBe(0)
2820
+ expect(root.getComputedWidth()).toBe(100)
2821
+ expect(root.getComputedHeight()).toBe(100)
2822
+
2823
+ expect(root_child0.getComputedLeft()).toBe(0)
2824
+ expect(root_child0.getComputedTop()).toBe(0)
2825
+ expect(root_child0.getComputedWidth()).toBe(100)
2826
+ expect(root_child0.getComputedHeight()).toBe(100)
2827
+
2828
+ expect(root_child0_child0.getComputedLeft()).toBe(80)
2829
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2830
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2831
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2832
+
2833
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2834
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2835
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2836
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2837
+
2838
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
2839
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2840
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2841
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2842
+
2843
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2844
+
2845
+ expect(root.getComputedLeft()).toBe(0)
2846
+ expect(root.getComputedTop()).toBe(0)
2847
+ expect(root.getComputedWidth()).toBe(100)
2848
+ expect(root.getComputedHeight()).toBe(100)
2849
+
2850
+ expect(root_child0.getComputedLeft()).toBe(0)
2851
+ expect(root_child0.getComputedTop()).toBe(0)
2852
+ expect(root_child0.getComputedWidth()).toBe(100)
2853
+ expect(root_child0.getComputedHeight()).toBe(100)
2854
+
2855
+ expect(root_child0_child0.getComputedLeft()).toBe(10)
2856
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2857
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2858
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2859
+
2860
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2861
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2862
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2863
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2864
+
2865
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
2866
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2867
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2868
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2869
+ } finally {
2870
+ if (typeof root !== "undefined") {
2871
+ root.freeRecursive()
2872
+ }
2873
+
2874
+ config.free()
2875
+ }
2876
+ })
2877
+ test("flex_direction_row_reverse_inner_margin_left", () => {
2878
+ const config = Yoga.Config.create()
2879
+ let root
2880
+
2881
+ try {
2882
+ root = Yoga.Node.create(config)
2883
+ root.setPositionType(PositionType.Absolute)
2884
+ root.setWidth(100)
2885
+ root.setHeight(100)
2886
+
2887
+ const root_child0 = Yoga.Node.create(config)
2888
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2889
+ root_child0.setWidth(100)
2890
+ root_child0.setHeight(100)
2891
+ root.insertChild(root_child0, 0)
2892
+
2893
+ const root_child0_child0 = Yoga.Node.create(config)
2894
+ root_child0_child0.setPositionType(PositionType.Absolute)
2895
+ root_child0_child0.setMargin(Edge.Left, 10)
2896
+ root_child0_child0.setWidth(10)
2897
+ root_child0_child0.setHeight(10)
2898
+ root_child0.insertChild(root_child0_child0, 0)
2899
+
2900
+ const root_child0_child1 = Yoga.Node.create(config)
2901
+ root_child0_child1.setWidth(10)
2902
+ root_child0.insertChild(root_child0_child1, 1)
2903
+
2904
+ const root_child0_child2 = Yoga.Node.create(config)
2905
+ root_child0_child2.setWidth(10)
2906
+ root_child0.insertChild(root_child0_child2, 2)
2907
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2908
+
2909
+ expect(root.getComputedLeft()).toBe(0)
2910
+ expect(root.getComputedTop()).toBe(0)
2911
+ expect(root.getComputedWidth()).toBe(100)
2912
+ expect(root.getComputedHeight()).toBe(100)
2913
+
2914
+ expect(root_child0.getComputedLeft()).toBe(0)
2915
+ expect(root_child0.getComputedTop()).toBe(0)
2916
+ expect(root_child0.getComputedWidth()).toBe(100)
2917
+ expect(root_child0.getComputedHeight()).toBe(100)
2918
+
2919
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
2920
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2921
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2922
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2923
+
2924
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
2925
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2926
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2927
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2928
+
2929
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
2930
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2931
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2932
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2933
+
2934
+ root.calculateLayout(undefined, undefined, Direction.RTL)
2935
+
2936
+ expect(root.getComputedLeft()).toBe(0)
2937
+ expect(root.getComputedTop()).toBe(0)
2938
+ expect(root.getComputedWidth()).toBe(100)
2939
+ expect(root.getComputedHeight()).toBe(100)
2940
+
2941
+ expect(root_child0.getComputedLeft()).toBe(0)
2942
+ expect(root_child0.getComputedTop()).toBe(0)
2943
+ expect(root_child0.getComputedWidth()).toBe(100)
2944
+ expect(root_child0.getComputedHeight()).toBe(100)
2945
+
2946
+ expect(root_child0_child0.getComputedLeft()).toBe(10)
2947
+ expect(root_child0_child0.getComputedTop()).toBe(0)
2948
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
2949
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
2950
+
2951
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
2952
+ expect(root_child0_child1.getComputedTop()).toBe(0)
2953
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
2954
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
2955
+
2956
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
2957
+ expect(root_child0_child2.getComputedTop()).toBe(0)
2958
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
2959
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
2960
+ } finally {
2961
+ if (typeof root !== "undefined") {
2962
+ root.freeRecursive()
2963
+ }
2964
+
2965
+ config.free()
2966
+ }
2967
+ })
2968
+ test("flex_direction_row_reverse_inner_margin_right", () => {
2969
+ const config = Yoga.Config.create()
2970
+ let root
2971
+
2972
+ try {
2973
+ root = Yoga.Node.create(config)
2974
+ root.setPositionType(PositionType.Absolute)
2975
+ root.setWidth(100)
2976
+ root.setHeight(100)
2977
+
2978
+ const root_child0 = Yoga.Node.create(config)
2979
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
2980
+ root_child0.setWidth(100)
2981
+ root_child0.setHeight(100)
2982
+ root.insertChild(root_child0, 0)
2983
+
2984
+ const root_child0_child0 = Yoga.Node.create(config)
2985
+ root_child0_child0.setPositionType(PositionType.Absolute)
2986
+ root_child0_child0.setMargin(Edge.Right, 10)
2987
+ root_child0_child0.setWidth(10)
2988
+ root_child0_child0.setHeight(10)
2989
+ root_child0.insertChild(root_child0_child0, 0)
2990
+
2991
+ const root_child0_child1 = Yoga.Node.create(config)
2992
+ root_child0_child1.setWidth(10)
2993
+ root_child0.insertChild(root_child0_child1, 1)
2994
+
2995
+ const root_child0_child2 = Yoga.Node.create(config)
2996
+ root_child0_child2.setWidth(10)
2997
+ root_child0.insertChild(root_child0_child2, 2)
2998
+ root.calculateLayout(undefined, undefined, Direction.LTR)
2999
+
3000
+ expect(root.getComputedLeft()).toBe(0)
3001
+ expect(root.getComputedTop()).toBe(0)
3002
+ expect(root.getComputedWidth()).toBe(100)
3003
+ expect(root.getComputedHeight()).toBe(100)
3004
+
3005
+ expect(root_child0.getComputedLeft()).toBe(0)
3006
+ expect(root_child0.getComputedTop()).toBe(0)
3007
+ expect(root_child0.getComputedWidth()).toBe(100)
3008
+ expect(root_child0.getComputedHeight()).toBe(100)
3009
+
3010
+ expect(root_child0_child0.getComputedLeft()).toBe(80)
3011
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3012
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3013
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3014
+
3015
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3016
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3017
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3018
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3019
+
3020
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3021
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3022
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3023
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3024
+
3025
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3026
+
3027
+ expect(root.getComputedLeft()).toBe(0)
3028
+ expect(root.getComputedTop()).toBe(0)
3029
+ expect(root.getComputedWidth()).toBe(100)
3030
+ expect(root.getComputedHeight()).toBe(100)
3031
+
3032
+ expect(root_child0.getComputedLeft()).toBe(0)
3033
+ expect(root_child0.getComputedTop()).toBe(0)
3034
+ expect(root_child0.getComputedWidth()).toBe(100)
3035
+ expect(root_child0.getComputedHeight()).toBe(100)
3036
+
3037
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3038
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3039
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3040
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3041
+
3042
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3043
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3044
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3045
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3046
+
3047
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3048
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3049
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3050
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3051
+ } finally {
3052
+ if (typeof root !== "undefined") {
3053
+ root.freeRecursive()
3054
+ }
3055
+
3056
+ config.free()
3057
+ }
3058
+ })
3059
+ test("flex_direction_col_reverse_inner_margin_top", () => {
3060
+ const config = Yoga.Config.create()
3061
+ let root
3062
+
3063
+ try {
3064
+ root = Yoga.Node.create(config)
3065
+ root.setPositionType(PositionType.Absolute)
3066
+ root.setWidth(100)
3067
+ root.setHeight(100)
3068
+
3069
+ const root_child0 = Yoga.Node.create(config)
3070
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
3071
+ root_child0.setWidth(100)
3072
+ root_child0.setHeight(100)
3073
+ root.insertChild(root_child0, 0)
3074
+
3075
+ const root_child0_child0 = Yoga.Node.create(config)
3076
+ root_child0_child0.setPositionType(PositionType.Absolute)
3077
+ root_child0_child0.setMargin(Edge.Top, 10)
3078
+ root_child0_child0.setWidth(10)
3079
+ root_child0_child0.setHeight(10)
3080
+ root_child0.insertChild(root_child0_child0, 0)
3081
+
3082
+ const root_child0_child1 = Yoga.Node.create(config)
3083
+ root_child0_child1.setWidth(10)
3084
+ root_child0.insertChild(root_child0_child1, 1)
3085
+
3086
+ const root_child0_child2 = Yoga.Node.create(config)
3087
+ root_child0_child2.setWidth(10)
3088
+ root_child0.insertChild(root_child0_child2, 2)
3089
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3090
+
3091
+ expect(root.getComputedLeft()).toBe(0)
3092
+ expect(root.getComputedTop()).toBe(0)
3093
+ expect(root.getComputedWidth()).toBe(100)
3094
+ expect(root.getComputedHeight()).toBe(100)
3095
+
3096
+ expect(root_child0.getComputedLeft()).toBe(0)
3097
+ expect(root_child0.getComputedTop()).toBe(0)
3098
+ expect(root_child0.getComputedWidth()).toBe(100)
3099
+ expect(root_child0.getComputedHeight()).toBe(100)
3100
+
3101
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3102
+ expect(root_child0_child0.getComputedTop()).toBe(90)
3103
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3104
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3105
+
3106
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3107
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3108
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3109
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3110
+
3111
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
3112
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3113
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3114
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3115
+
3116
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3117
+
3118
+ expect(root.getComputedLeft()).toBe(0)
3119
+ expect(root.getComputedTop()).toBe(0)
3120
+ expect(root.getComputedWidth()).toBe(100)
3121
+ expect(root.getComputedHeight()).toBe(100)
3122
+
3123
+ expect(root_child0.getComputedLeft()).toBe(0)
3124
+ expect(root_child0.getComputedTop()).toBe(0)
3125
+ expect(root_child0.getComputedWidth()).toBe(100)
3126
+ expect(root_child0.getComputedHeight()).toBe(100)
3127
+
3128
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3129
+ expect(root_child0_child0.getComputedTop()).toBe(90)
3130
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3131
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3132
+
3133
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3134
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3135
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3136
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3137
+
3138
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
3139
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3140
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3141
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3142
+ } finally {
3143
+ if (typeof root !== "undefined") {
3144
+ root.freeRecursive()
3145
+ }
3146
+
3147
+ config.free()
3148
+ }
3149
+ })
3150
+ test("flex_direction_col_reverse_inner_margin_bottom", () => {
3151
+ const config = Yoga.Config.create()
3152
+ let root
3153
+
3154
+ try {
3155
+ root = Yoga.Node.create(config)
3156
+ root.setPositionType(PositionType.Absolute)
3157
+ root.setWidth(100)
3158
+ root.setHeight(100)
3159
+
3160
+ const root_child0 = Yoga.Node.create(config)
3161
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
3162
+ root_child0.setWidth(100)
3163
+ root_child0.setHeight(100)
3164
+ root.insertChild(root_child0, 0)
3165
+
3166
+ const root_child0_child0 = Yoga.Node.create(config)
3167
+ root_child0_child0.setPositionType(PositionType.Absolute)
3168
+ root_child0_child0.setMargin(Edge.Bottom, 10)
3169
+ root_child0_child0.setWidth(10)
3170
+ root_child0_child0.setHeight(10)
3171
+ root_child0.insertChild(root_child0_child0, 0)
3172
+
3173
+ const root_child0_child1 = Yoga.Node.create(config)
3174
+ root_child0_child1.setWidth(10)
3175
+ root_child0.insertChild(root_child0_child1, 1)
3176
+
3177
+ const root_child0_child2 = Yoga.Node.create(config)
3178
+ root_child0_child2.setWidth(10)
3179
+ root_child0.insertChild(root_child0_child2, 2)
3180
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3181
+
3182
+ expect(root.getComputedLeft()).toBe(0)
3183
+ expect(root.getComputedTop()).toBe(0)
3184
+ expect(root.getComputedWidth()).toBe(100)
3185
+ expect(root.getComputedHeight()).toBe(100)
3186
+
3187
+ expect(root_child0.getComputedLeft()).toBe(0)
3188
+ expect(root_child0.getComputedTop()).toBe(0)
3189
+ expect(root_child0.getComputedWidth()).toBe(100)
3190
+ expect(root_child0.getComputedHeight()).toBe(100)
3191
+
3192
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3193
+ expect(root_child0_child0.getComputedTop()).toBe(80)
3194
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3195
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3196
+
3197
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3198
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3199
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3200
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3201
+
3202
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
3203
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3204
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3205
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3206
+
3207
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3208
+
3209
+ expect(root.getComputedLeft()).toBe(0)
3210
+ expect(root.getComputedTop()).toBe(0)
3211
+ expect(root.getComputedWidth()).toBe(100)
3212
+ expect(root.getComputedHeight()).toBe(100)
3213
+
3214
+ expect(root_child0.getComputedLeft()).toBe(0)
3215
+ expect(root_child0.getComputedTop()).toBe(0)
3216
+ expect(root_child0.getComputedWidth()).toBe(100)
3217
+ expect(root_child0.getComputedHeight()).toBe(100)
3218
+
3219
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3220
+ expect(root_child0_child0.getComputedTop()).toBe(80)
3221
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3222
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3223
+
3224
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3225
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3226
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3227
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3228
+
3229
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
3230
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3231
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3232
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3233
+ } finally {
3234
+ if (typeof root !== "undefined") {
3235
+ root.freeRecursive()
3236
+ }
3237
+
3238
+ config.free()
3239
+ }
3240
+ })
3241
+ test("flex_direction_row_reverse_inner_marign_start", () => {
3242
+ const config = Yoga.Config.create()
3243
+ let root
3244
+
3245
+ try {
3246
+ root = Yoga.Node.create(config)
3247
+ root.setPositionType(PositionType.Absolute)
3248
+ root.setWidth(100)
3249
+ root.setHeight(100)
3250
+
3251
+ const root_child0 = Yoga.Node.create(config)
3252
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3253
+ root_child0.setWidth(100)
3254
+ root_child0.setHeight(100)
3255
+ root.insertChild(root_child0, 0)
3256
+
3257
+ const root_child0_child0 = Yoga.Node.create(config)
3258
+ root_child0_child0.setPositionType(PositionType.Absolute)
3259
+ root_child0_child0.setMargin(Edge.Start, 10)
3260
+ root_child0_child0.setWidth(10)
3261
+ root_child0_child0.setHeight(10)
3262
+ root_child0.insertChild(root_child0_child0, 0)
3263
+
3264
+ const root_child0_child1 = Yoga.Node.create(config)
3265
+ root_child0_child1.setWidth(10)
3266
+ root_child0.insertChild(root_child0_child1, 1)
3267
+
3268
+ const root_child0_child2 = Yoga.Node.create(config)
3269
+ root_child0_child2.setWidth(10)
3270
+ root_child0.insertChild(root_child0_child2, 2)
3271
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3272
+
3273
+ expect(root.getComputedLeft()).toBe(0)
3274
+ expect(root.getComputedTop()).toBe(0)
3275
+ expect(root.getComputedWidth()).toBe(100)
3276
+ expect(root.getComputedHeight()).toBe(100)
3277
+
3278
+ expect(root_child0.getComputedLeft()).toBe(0)
3279
+ expect(root_child0.getComputedTop()).toBe(0)
3280
+ expect(root_child0.getComputedWidth()).toBe(100)
3281
+ expect(root_child0.getComputedHeight()).toBe(100)
3282
+
3283
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3284
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3285
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3286
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3287
+
3288
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3289
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3290
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3291
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3292
+
3293
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3294
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3295
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3296
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3297
+
3298
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3299
+
3300
+ expect(root.getComputedLeft()).toBe(0)
3301
+ expect(root.getComputedTop()).toBe(0)
3302
+ expect(root.getComputedWidth()).toBe(100)
3303
+ expect(root.getComputedHeight()).toBe(100)
3304
+
3305
+ expect(root_child0.getComputedLeft()).toBe(0)
3306
+ expect(root_child0.getComputedTop()).toBe(0)
3307
+ expect(root_child0.getComputedWidth()).toBe(100)
3308
+ expect(root_child0.getComputedHeight()).toBe(100)
3309
+
3310
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3311
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3312
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3313
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3314
+
3315
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3316
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3317
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3318
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3319
+
3320
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3321
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3322
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3323
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3324
+ } finally {
3325
+ if (typeof root !== "undefined") {
3326
+ root.freeRecursive()
3327
+ }
3328
+
3329
+ config.free()
3330
+ }
3331
+ })
3332
+ test("flex_direction_row_reverse_inner_margin_end", () => {
3333
+ const config = Yoga.Config.create()
3334
+ let root
3335
+
3336
+ try {
3337
+ root = Yoga.Node.create(config)
3338
+ root.setPositionType(PositionType.Absolute)
3339
+ root.setWidth(100)
3340
+ root.setHeight(100)
3341
+
3342
+ const root_child0 = Yoga.Node.create(config)
3343
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3344
+ root_child0.setWidth(100)
3345
+ root_child0.setHeight(100)
3346
+ root.insertChild(root_child0, 0)
3347
+
3348
+ const root_child0_child0 = Yoga.Node.create(config)
3349
+ root_child0_child0.setPositionType(PositionType.Absolute)
3350
+ root_child0_child0.setMargin(Edge.End, 10)
3351
+ root_child0_child0.setWidth(10)
3352
+ root_child0_child0.setHeight(10)
3353
+ root_child0.insertChild(root_child0_child0, 0)
3354
+
3355
+ const root_child0_child1 = Yoga.Node.create(config)
3356
+ root_child0_child1.setWidth(10)
3357
+ root_child0.insertChild(root_child0_child1, 1)
3358
+
3359
+ const root_child0_child2 = Yoga.Node.create(config)
3360
+ root_child0_child2.setWidth(10)
3361
+ root_child0.insertChild(root_child0_child2, 2)
3362
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3363
+
3364
+ expect(root.getComputedLeft()).toBe(0)
3365
+ expect(root.getComputedTop()).toBe(0)
3366
+ expect(root.getComputedWidth()).toBe(100)
3367
+ expect(root.getComputedHeight()).toBe(100)
3368
+
3369
+ expect(root_child0.getComputedLeft()).toBe(0)
3370
+ expect(root_child0.getComputedTop()).toBe(0)
3371
+ expect(root_child0.getComputedWidth()).toBe(100)
3372
+ expect(root_child0.getComputedHeight()).toBe(100)
3373
+
3374
+ expect(root_child0_child0.getComputedLeft()).toBe(80)
3375
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3376
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3377
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3378
+
3379
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3380
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3381
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3382
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3383
+
3384
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3385
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3386
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3387
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3388
+
3389
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3390
+
3391
+ expect(root.getComputedLeft()).toBe(0)
3392
+ expect(root.getComputedTop()).toBe(0)
3393
+ expect(root.getComputedWidth()).toBe(100)
3394
+ expect(root.getComputedHeight()).toBe(100)
3395
+
3396
+ expect(root_child0.getComputedLeft()).toBe(0)
3397
+ expect(root_child0.getComputedTop()).toBe(0)
3398
+ expect(root_child0.getComputedWidth()).toBe(100)
3399
+ expect(root_child0.getComputedHeight()).toBe(100)
3400
+
3401
+ expect(root_child0_child0.getComputedLeft()).toBe(10)
3402
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3403
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3404
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3405
+
3406
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3407
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3408
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3409
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3410
+
3411
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3412
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3413
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3414
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3415
+ } finally {
3416
+ if (typeof root !== "undefined") {
3417
+ root.freeRecursive()
3418
+ }
3419
+
3420
+ config.free()
3421
+ }
3422
+ })
3423
+ test("flex_direction_row_reverse_inner_border_left", () => {
3424
+ const config = Yoga.Config.create()
3425
+ let root
3426
+
3427
+ try {
3428
+ root = Yoga.Node.create(config)
3429
+ root.setPositionType(PositionType.Absolute)
3430
+ root.setWidth(100)
3431
+ root.setHeight(100)
3432
+
3433
+ const root_child0 = Yoga.Node.create(config)
3434
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3435
+ root_child0.setWidth(100)
3436
+ root_child0.setHeight(100)
3437
+ root.insertChild(root_child0, 0)
3438
+
3439
+ const root_child0_child0 = Yoga.Node.create(config)
3440
+ root_child0_child0.setPositionType(PositionType.Absolute)
3441
+ root_child0_child0.setBorder(Edge.Left, 10)
3442
+ root_child0_child0.setWidth(10)
3443
+ root_child0_child0.setHeight(10)
3444
+ root_child0.insertChild(root_child0_child0, 0)
3445
+
3446
+ const root_child0_child1 = Yoga.Node.create(config)
3447
+ root_child0_child1.setWidth(10)
3448
+ root_child0.insertChild(root_child0_child1, 1)
3449
+
3450
+ const root_child0_child2 = Yoga.Node.create(config)
3451
+ root_child0_child2.setWidth(10)
3452
+ root_child0.insertChild(root_child0_child2, 2)
3453
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3454
+
3455
+ expect(root.getComputedLeft()).toBe(0)
3456
+ expect(root.getComputedTop()).toBe(0)
3457
+ expect(root.getComputedWidth()).toBe(100)
3458
+ expect(root.getComputedHeight()).toBe(100)
3459
+
3460
+ expect(root_child0.getComputedLeft()).toBe(0)
3461
+ expect(root_child0.getComputedTop()).toBe(0)
3462
+ expect(root_child0.getComputedWidth()).toBe(100)
3463
+ expect(root_child0.getComputedHeight()).toBe(100)
3464
+
3465
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3466
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3467
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3468
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3469
+
3470
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3471
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3472
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3473
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3474
+
3475
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3476
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3477
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3478
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3479
+
3480
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3481
+
3482
+ expect(root.getComputedLeft()).toBe(0)
3483
+ expect(root.getComputedTop()).toBe(0)
3484
+ expect(root.getComputedWidth()).toBe(100)
3485
+ expect(root.getComputedHeight()).toBe(100)
3486
+
3487
+ expect(root_child0.getComputedLeft()).toBe(0)
3488
+ expect(root_child0.getComputedTop()).toBe(0)
3489
+ expect(root_child0.getComputedWidth()).toBe(100)
3490
+ expect(root_child0.getComputedHeight()).toBe(100)
3491
+
3492
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3493
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3494
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3495
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3496
+
3497
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3498
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3499
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3500
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3501
+
3502
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3503
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3504
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3505
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3506
+ } finally {
3507
+ if (typeof root !== "undefined") {
3508
+ root.freeRecursive()
3509
+ }
3510
+
3511
+ config.free()
3512
+ }
3513
+ })
3514
+ test("flex_direction_row_reverse_inner_border_right", () => {
3515
+ const config = Yoga.Config.create()
3516
+ let root
3517
+
3518
+ try {
3519
+ root = Yoga.Node.create(config)
3520
+ root.setPositionType(PositionType.Absolute)
3521
+ root.setWidth(100)
3522
+ root.setHeight(100)
3523
+
3524
+ const root_child0 = Yoga.Node.create(config)
3525
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3526
+ root_child0.setWidth(100)
3527
+ root_child0.setHeight(100)
3528
+ root.insertChild(root_child0, 0)
3529
+
3530
+ const root_child0_child0 = Yoga.Node.create(config)
3531
+ root_child0_child0.setPositionType(PositionType.Absolute)
3532
+ root_child0_child0.setBorder(Edge.Right, 10)
3533
+ root_child0_child0.setWidth(10)
3534
+ root_child0_child0.setHeight(10)
3535
+ root_child0.insertChild(root_child0_child0, 0)
3536
+
3537
+ const root_child0_child1 = Yoga.Node.create(config)
3538
+ root_child0_child1.setWidth(10)
3539
+ root_child0.insertChild(root_child0_child1, 1)
3540
+
3541
+ const root_child0_child2 = Yoga.Node.create(config)
3542
+ root_child0_child2.setWidth(10)
3543
+ root_child0.insertChild(root_child0_child2, 2)
3544
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3545
+
3546
+ expect(root.getComputedLeft()).toBe(0)
3547
+ expect(root.getComputedTop()).toBe(0)
3548
+ expect(root.getComputedWidth()).toBe(100)
3549
+ expect(root.getComputedHeight()).toBe(100)
3550
+
3551
+ expect(root_child0.getComputedLeft()).toBe(0)
3552
+ expect(root_child0.getComputedTop()).toBe(0)
3553
+ expect(root_child0.getComputedWidth()).toBe(100)
3554
+ expect(root_child0.getComputedHeight()).toBe(100)
3555
+
3556
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3557
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3558
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3559
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3560
+
3561
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3562
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3563
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3564
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3565
+
3566
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3567
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3568
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3569
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3570
+
3571
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3572
+
3573
+ expect(root.getComputedLeft()).toBe(0)
3574
+ expect(root.getComputedTop()).toBe(0)
3575
+ expect(root.getComputedWidth()).toBe(100)
3576
+ expect(root.getComputedHeight()).toBe(100)
3577
+
3578
+ expect(root_child0.getComputedLeft()).toBe(0)
3579
+ expect(root_child0.getComputedTop()).toBe(0)
3580
+ expect(root_child0.getComputedWidth()).toBe(100)
3581
+ expect(root_child0.getComputedHeight()).toBe(100)
3582
+
3583
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3584
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3585
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3586
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3587
+
3588
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3589
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3590
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3591
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3592
+
3593
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3594
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3595
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3596
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3597
+ } finally {
3598
+ if (typeof root !== "undefined") {
3599
+ root.freeRecursive()
3600
+ }
3601
+
3602
+ config.free()
3603
+ }
3604
+ })
3605
+ test("flex_direction_col_reverse_inner_border_top", () => {
3606
+ const config = Yoga.Config.create()
3607
+ let root
3608
+
3609
+ try {
3610
+ root = Yoga.Node.create(config)
3611
+ root.setPositionType(PositionType.Absolute)
3612
+ root.setWidth(100)
3613
+ root.setHeight(100)
3614
+
3615
+ const root_child0 = Yoga.Node.create(config)
3616
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
3617
+ root_child0.setWidth(100)
3618
+ root_child0.setHeight(100)
3619
+ root.insertChild(root_child0, 0)
3620
+
3621
+ const root_child0_child0 = Yoga.Node.create(config)
3622
+ root_child0_child0.setPositionType(PositionType.Absolute)
3623
+ root_child0_child0.setBorder(Edge.Top, 10)
3624
+ root_child0_child0.setWidth(10)
3625
+ root_child0_child0.setHeight(10)
3626
+ root_child0.insertChild(root_child0_child0, 0)
3627
+
3628
+ const root_child0_child1 = Yoga.Node.create(config)
3629
+ root_child0_child1.setWidth(10)
3630
+ root_child0.insertChild(root_child0_child1, 1)
3631
+
3632
+ const root_child0_child2 = Yoga.Node.create(config)
3633
+ root_child0_child2.setWidth(10)
3634
+ root_child0.insertChild(root_child0_child2, 2)
3635
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3636
+
3637
+ expect(root.getComputedLeft()).toBe(0)
3638
+ expect(root.getComputedTop()).toBe(0)
3639
+ expect(root.getComputedWidth()).toBe(100)
3640
+ expect(root.getComputedHeight()).toBe(100)
3641
+
3642
+ expect(root_child0.getComputedLeft()).toBe(0)
3643
+ expect(root_child0.getComputedTop()).toBe(0)
3644
+ expect(root_child0.getComputedWidth()).toBe(100)
3645
+ expect(root_child0.getComputedHeight()).toBe(100)
3646
+
3647
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3648
+ expect(root_child0_child0.getComputedTop()).toBe(90)
3649
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3650
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3651
+
3652
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3653
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3654
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3655
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3656
+
3657
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
3658
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3659
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3660
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3661
+
3662
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3663
+
3664
+ expect(root.getComputedLeft()).toBe(0)
3665
+ expect(root.getComputedTop()).toBe(0)
3666
+ expect(root.getComputedWidth()).toBe(100)
3667
+ expect(root.getComputedHeight()).toBe(100)
3668
+
3669
+ expect(root_child0.getComputedLeft()).toBe(0)
3670
+ expect(root_child0.getComputedTop()).toBe(0)
3671
+ expect(root_child0.getComputedWidth()).toBe(100)
3672
+ expect(root_child0.getComputedHeight()).toBe(100)
3673
+
3674
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3675
+ expect(root_child0_child0.getComputedTop()).toBe(90)
3676
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3677
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3678
+
3679
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3680
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3681
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3682
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3683
+
3684
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
3685
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3686
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3687
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3688
+ } finally {
3689
+ if (typeof root !== "undefined") {
3690
+ root.freeRecursive()
3691
+ }
3692
+
3693
+ config.free()
3694
+ }
3695
+ })
3696
+ test("flex_direction_col_reverse_inner_border_bottom", () => {
3697
+ const config = Yoga.Config.create()
3698
+ let root
3699
+
3700
+ try {
3701
+ root = Yoga.Node.create(config)
3702
+ root.setPositionType(PositionType.Absolute)
3703
+ root.setWidth(100)
3704
+ root.setHeight(100)
3705
+
3706
+ const root_child0 = Yoga.Node.create(config)
3707
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
3708
+ root_child0.setWidth(100)
3709
+ root_child0.setHeight(100)
3710
+ root.insertChild(root_child0, 0)
3711
+
3712
+ const root_child0_child0 = Yoga.Node.create(config)
3713
+ root_child0_child0.setPositionType(PositionType.Absolute)
3714
+ root_child0_child0.setBorder(Edge.Bottom, 10)
3715
+ root_child0_child0.setWidth(10)
3716
+ root_child0_child0.setHeight(10)
3717
+ root_child0.insertChild(root_child0_child0, 0)
3718
+
3719
+ const root_child0_child1 = Yoga.Node.create(config)
3720
+ root_child0_child1.setWidth(10)
3721
+ root_child0.insertChild(root_child0_child1, 1)
3722
+
3723
+ const root_child0_child2 = Yoga.Node.create(config)
3724
+ root_child0_child2.setWidth(10)
3725
+ root_child0.insertChild(root_child0_child2, 2)
3726
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3727
+
3728
+ expect(root.getComputedLeft()).toBe(0)
3729
+ expect(root.getComputedTop()).toBe(0)
3730
+ expect(root.getComputedWidth()).toBe(100)
3731
+ expect(root.getComputedHeight()).toBe(100)
3732
+
3733
+ expect(root_child0.getComputedLeft()).toBe(0)
3734
+ expect(root_child0.getComputedTop()).toBe(0)
3735
+ expect(root_child0.getComputedWidth()).toBe(100)
3736
+ expect(root_child0.getComputedHeight()).toBe(100)
3737
+
3738
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3739
+ expect(root_child0_child0.getComputedTop()).toBe(90)
3740
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3741
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3742
+
3743
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3744
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3745
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3746
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3747
+
3748
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
3749
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3750
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3751
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3752
+
3753
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3754
+
3755
+ expect(root.getComputedLeft()).toBe(0)
3756
+ expect(root.getComputedTop()).toBe(0)
3757
+ expect(root.getComputedWidth()).toBe(100)
3758
+ expect(root.getComputedHeight()).toBe(100)
3759
+
3760
+ expect(root_child0.getComputedLeft()).toBe(0)
3761
+ expect(root_child0.getComputedTop()).toBe(0)
3762
+ expect(root_child0.getComputedWidth()).toBe(100)
3763
+ expect(root_child0.getComputedHeight()).toBe(100)
3764
+
3765
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3766
+ expect(root_child0_child0.getComputedTop()).toBe(90)
3767
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3768
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3769
+
3770
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3771
+ expect(root_child0_child1.getComputedTop()).toBe(100)
3772
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3773
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
3774
+
3775
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
3776
+ expect(root_child0_child2.getComputedTop()).toBe(100)
3777
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3778
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
3779
+ } finally {
3780
+ if (typeof root !== "undefined") {
3781
+ root.freeRecursive()
3782
+ }
3783
+
3784
+ config.free()
3785
+ }
3786
+ })
3787
+ test("flex_direction_row_reverse_inner_border_start", () => {
3788
+ const config = Yoga.Config.create()
3789
+ let root
3790
+
3791
+ try {
3792
+ root = Yoga.Node.create(config)
3793
+ root.setPositionType(PositionType.Absolute)
3794
+ root.setWidth(100)
3795
+ root.setHeight(100)
3796
+
3797
+ const root_child0 = Yoga.Node.create(config)
3798
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3799
+ root_child0.setWidth(100)
3800
+ root_child0.setHeight(100)
3801
+ root.insertChild(root_child0, 0)
3802
+
3803
+ const root_child0_child0 = Yoga.Node.create(config)
3804
+ root_child0_child0.setPositionType(PositionType.Absolute)
3805
+ root_child0_child0.setBorder(Edge.Left, 10)
3806
+ root_child0_child0.setWidth(10)
3807
+ root_child0_child0.setHeight(10)
3808
+ root_child0.insertChild(root_child0_child0, 0)
3809
+
3810
+ const root_child0_child1 = Yoga.Node.create(config)
3811
+ root_child0_child1.setWidth(10)
3812
+ root_child0.insertChild(root_child0_child1, 1)
3813
+
3814
+ const root_child0_child2 = Yoga.Node.create(config)
3815
+ root_child0_child2.setWidth(10)
3816
+ root_child0.insertChild(root_child0_child2, 2)
3817
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3818
+
3819
+ expect(root.getComputedLeft()).toBe(0)
3820
+ expect(root.getComputedTop()).toBe(0)
3821
+ expect(root.getComputedWidth()).toBe(100)
3822
+ expect(root.getComputedHeight()).toBe(100)
3823
+
3824
+ expect(root_child0.getComputedLeft()).toBe(0)
3825
+ expect(root_child0.getComputedTop()).toBe(0)
3826
+ expect(root_child0.getComputedWidth()).toBe(100)
3827
+ expect(root_child0.getComputedHeight()).toBe(100)
3828
+
3829
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3830
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3831
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3832
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3833
+
3834
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3835
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3836
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3837
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3838
+
3839
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3840
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3841
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3842
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3843
+
3844
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3845
+
3846
+ expect(root.getComputedLeft()).toBe(0)
3847
+ expect(root.getComputedTop()).toBe(0)
3848
+ expect(root.getComputedWidth()).toBe(100)
3849
+ expect(root.getComputedHeight()).toBe(100)
3850
+
3851
+ expect(root_child0.getComputedLeft()).toBe(0)
3852
+ expect(root_child0.getComputedTop()).toBe(0)
3853
+ expect(root_child0.getComputedWidth()).toBe(100)
3854
+ expect(root_child0.getComputedHeight()).toBe(100)
3855
+
3856
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3857
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3858
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3859
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3860
+
3861
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3862
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3863
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3864
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3865
+
3866
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3867
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3868
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3869
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3870
+ } finally {
3871
+ if (typeof root !== "undefined") {
3872
+ root.freeRecursive()
3873
+ }
3874
+
3875
+ config.free()
3876
+ }
3877
+ })
3878
+ test("flex_direction_row_reverse_inner_border_end", () => {
3879
+ const config = Yoga.Config.create()
3880
+ let root
3881
+
3882
+ try {
3883
+ root = Yoga.Node.create(config)
3884
+ root.setPositionType(PositionType.Absolute)
3885
+ root.setWidth(100)
3886
+ root.setHeight(100)
3887
+
3888
+ const root_child0 = Yoga.Node.create(config)
3889
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3890
+ root_child0.setWidth(100)
3891
+ root_child0.setHeight(100)
3892
+ root.insertChild(root_child0, 0)
3893
+
3894
+ const root_child0_child0 = Yoga.Node.create(config)
3895
+ root_child0_child0.setPositionType(PositionType.Absolute)
3896
+ root_child0_child0.setBorder(Edge.Right, 10)
3897
+ root_child0_child0.setWidth(10)
3898
+ root_child0_child0.setHeight(10)
3899
+ root_child0.insertChild(root_child0_child0, 0)
3900
+
3901
+ const root_child0_child1 = Yoga.Node.create(config)
3902
+ root_child0_child1.setWidth(10)
3903
+ root_child0.insertChild(root_child0_child1, 1)
3904
+
3905
+ const root_child0_child2 = Yoga.Node.create(config)
3906
+ root_child0_child2.setWidth(10)
3907
+ root_child0.insertChild(root_child0_child2, 2)
3908
+ root.calculateLayout(undefined, undefined, Direction.LTR)
3909
+
3910
+ expect(root.getComputedLeft()).toBe(0)
3911
+ expect(root.getComputedTop()).toBe(0)
3912
+ expect(root.getComputedWidth()).toBe(100)
3913
+ expect(root.getComputedHeight()).toBe(100)
3914
+
3915
+ expect(root_child0.getComputedLeft()).toBe(0)
3916
+ expect(root_child0.getComputedTop()).toBe(0)
3917
+ expect(root_child0.getComputedWidth()).toBe(100)
3918
+ expect(root_child0.getComputedHeight()).toBe(100)
3919
+
3920
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
3921
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3922
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3923
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3924
+
3925
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
3926
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3927
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3928
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3929
+
3930
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
3931
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3932
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3933
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3934
+
3935
+ root.calculateLayout(undefined, undefined, Direction.RTL)
3936
+
3937
+ expect(root.getComputedLeft()).toBe(0)
3938
+ expect(root.getComputedTop()).toBe(0)
3939
+ expect(root.getComputedWidth()).toBe(100)
3940
+ expect(root.getComputedHeight()).toBe(100)
3941
+
3942
+ expect(root_child0.getComputedLeft()).toBe(0)
3943
+ expect(root_child0.getComputedTop()).toBe(0)
3944
+ expect(root_child0.getComputedWidth()).toBe(100)
3945
+ expect(root_child0.getComputedHeight()).toBe(100)
3946
+
3947
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
3948
+ expect(root_child0_child0.getComputedTop()).toBe(0)
3949
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
3950
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
3951
+
3952
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
3953
+ expect(root_child0_child1.getComputedTop()).toBe(0)
3954
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
3955
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
3956
+
3957
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
3958
+ expect(root_child0_child2.getComputedTop()).toBe(0)
3959
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
3960
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
3961
+ } finally {
3962
+ if (typeof root !== "undefined") {
3963
+ root.freeRecursive()
3964
+ }
3965
+
3966
+ config.free()
3967
+ }
3968
+ })
3969
+ test("flex_direction_row_reverse_inner_padding_left", () => {
3970
+ const config = Yoga.Config.create()
3971
+ let root
3972
+
3973
+ try {
3974
+ root = Yoga.Node.create(config)
3975
+ root.setPositionType(PositionType.Absolute)
3976
+ root.setWidth(100)
3977
+ root.setHeight(100)
3978
+
3979
+ const root_child0 = Yoga.Node.create(config)
3980
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
3981
+ root_child0.setWidth(100)
3982
+ root_child0.setHeight(100)
3983
+ root.insertChild(root_child0, 0)
3984
+
3985
+ const root_child0_child0 = Yoga.Node.create(config)
3986
+ root_child0_child0.setPositionType(PositionType.Absolute)
3987
+ root_child0_child0.setPadding(Edge.Left, 10)
3988
+ root_child0_child0.setWidth(10)
3989
+ root_child0_child0.setHeight(10)
3990
+ root_child0.insertChild(root_child0_child0, 0)
3991
+
3992
+ const root_child0_child1 = Yoga.Node.create(config)
3993
+ root_child0_child1.setWidth(10)
3994
+ root_child0.insertChild(root_child0_child1, 1)
3995
+
3996
+ const root_child0_child2 = Yoga.Node.create(config)
3997
+ root_child0_child2.setWidth(10)
3998
+ root_child0.insertChild(root_child0_child2, 2)
3999
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4000
+
4001
+ expect(root.getComputedLeft()).toBe(0)
4002
+ expect(root.getComputedTop()).toBe(0)
4003
+ expect(root.getComputedWidth()).toBe(100)
4004
+ expect(root.getComputedHeight()).toBe(100)
4005
+
4006
+ expect(root_child0.getComputedLeft()).toBe(0)
4007
+ expect(root_child0.getComputedTop()).toBe(0)
4008
+ expect(root_child0.getComputedWidth()).toBe(100)
4009
+ expect(root_child0.getComputedHeight()).toBe(100)
4010
+
4011
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
4012
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4013
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4014
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4015
+
4016
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
4017
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4018
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4019
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4020
+
4021
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
4022
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4023
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4024
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4025
+
4026
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4027
+
4028
+ expect(root.getComputedLeft()).toBe(0)
4029
+ expect(root.getComputedTop()).toBe(0)
4030
+ expect(root.getComputedWidth()).toBe(100)
4031
+ expect(root.getComputedHeight()).toBe(100)
4032
+
4033
+ expect(root_child0.getComputedLeft()).toBe(0)
4034
+ expect(root_child0.getComputedTop()).toBe(0)
4035
+ expect(root_child0.getComputedWidth()).toBe(100)
4036
+ expect(root_child0.getComputedHeight()).toBe(100)
4037
+
4038
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
4039
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4040
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4041
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4042
+
4043
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
4044
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4045
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4046
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4047
+
4048
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
4049
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4050
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4051
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4052
+ } finally {
4053
+ if (typeof root !== "undefined") {
4054
+ root.freeRecursive()
4055
+ }
4056
+
4057
+ config.free()
4058
+ }
4059
+ })
4060
+ test("flex_direction_row_reverse_inner_padding_right", () => {
4061
+ const config = Yoga.Config.create()
4062
+ let root
4063
+
4064
+ try {
4065
+ root = Yoga.Node.create(config)
4066
+ root.setPositionType(PositionType.Absolute)
4067
+ root.setWidth(100)
4068
+ root.setHeight(100)
4069
+
4070
+ const root_child0 = Yoga.Node.create(config)
4071
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
4072
+ root_child0.setWidth(100)
4073
+ root_child0.setHeight(100)
4074
+ root.insertChild(root_child0, 0)
4075
+
4076
+ const root_child0_child0 = Yoga.Node.create(config)
4077
+ root_child0_child0.setPositionType(PositionType.Absolute)
4078
+ root_child0_child0.setPadding(Edge.Right, 10)
4079
+ root_child0_child0.setWidth(10)
4080
+ root_child0_child0.setHeight(10)
4081
+ root_child0.insertChild(root_child0_child0, 0)
4082
+
4083
+ const root_child0_child1 = Yoga.Node.create(config)
4084
+ root_child0_child1.setWidth(10)
4085
+ root_child0.insertChild(root_child0_child1, 1)
4086
+
4087
+ const root_child0_child2 = Yoga.Node.create(config)
4088
+ root_child0_child2.setWidth(10)
4089
+ root_child0.insertChild(root_child0_child2, 2)
4090
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4091
+
4092
+ expect(root.getComputedLeft()).toBe(0)
4093
+ expect(root.getComputedTop()).toBe(0)
4094
+ expect(root.getComputedWidth()).toBe(100)
4095
+ expect(root.getComputedHeight()).toBe(100)
4096
+
4097
+ expect(root_child0.getComputedLeft()).toBe(0)
4098
+ expect(root_child0.getComputedTop()).toBe(0)
4099
+ expect(root_child0.getComputedWidth()).toBe(100)
4100
+ expect(root_child0.getComputedHeight()).toBe(100)
4101
+
4102
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
4103
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4104
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4105
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4106
+
4107
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
4108
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4109
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4110
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4111
+
4112
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
4113
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4114
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4115
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4116
+
4117
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4118
+
4119
+ expect(root.getComputedLeft()).toBe(0)
4120
+ expect(root.getComputedTop()).toBe(0)
4121
+ expect(root.getComputedWidth()).toBe(100)
4122
+ expect(root.getComputedHeight()).toBe(100)
4123
+
4124
+ expect(root_child0.getComputedLeft()).toBe(0)
4125
+ expect(root_child0.getComputedTop()).toBe(0)
4126
+ expect(root_child0.getComputedWidth()).toBe(100)
4127
+ expect(root_child0.getComputedHeight()).toBe(100)
4128
+
4129
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
4130
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4131
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4132
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4133
+
4134
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
4135
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4136
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4137
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4138
+
4139
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
4140
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4141
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4142
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4143
+ } finally {
4144
+ if (typeof root !== "undefined") {
4145
+ root.freeRecursive()
4146
+ }
4147
+
4148
+ config.free()
4149
+ }
4150
+ })
4151
+ test("flex_direction_col_reverse_inner_padding_top", () => {
4152
+ const config = Yoga.Config.create()
4153
+ let root
4154
+
4155
+ try {
4156
+ root = Yoga.Node.create(config)
4157
+ root.setPositionType(PositionType.Absolute)
4158
+ root.setWidth(100)
4159
+ root.setHeight(100)
4160
+
4161
+ const root_child0 = Yoga.Node.create(config)
4162
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
4163
+ root_child0.setWidth(100)
4164
+ root_child0.setHeight(100)
4165
+ root.insertChild(root_child0, 0)
4166
+
4167
+ const root_child0_child0 = Yoga.Node.create(config)
4168
+ root_child0_child0.setPositionType(PositionType.Absolute)
4169
+ root_child0_child0.setPadding(Edge.Top, 10)
4170
+ root_child0_child0.setWidth(10)
4171
+ root_child0_child0.setHeight(10)
4172
+ root_child0.insertChild(root_child0_child0, 0)
4173
+
4174
+ const root_child0_child1 = Yoga.Node.create(config)
4175
+ root_child0_child1.setWidth(10)
4176
+ root_child0.insertChild(root_child0_child1, 1)
4177
+
4178
+ const root_child0_child2 = Yoga.Node.create(config)
4179
+ root_child0_child2.setWidth(10)
4180
+ root_child0.insertChild(root_child0_child2, 2)
4181
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4182
+
4183
+ expect(root.getComputedLeft()).toBe(0)
4184
+ expect(root.getComputedTop()).toBe(0)
4185
+ expect(root.getComputedWidth()).toBe(100)
4186
+ expect(root.getComputedHeight()).toBe(100)
4187
+
4188
+ expect(root_child0.getComputedLeft()).toBe(0)
4189
+ expect(root_child0.getComputedTop()).toBe(0)
4190
+ expect(root_child0.getComputedWidth()).toBe(100)
4191
+ expect(root_child0.getComputedHeight()).toBe(100)
4192
+
4193
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
4194
+ expect(root_child0_child0.getComputedTop()).toBe(90)
4195
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4196
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4197
+
4198
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
4199
+ expect(root_child0_child1.getComputedTop()).toBe(100)
4200
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4201
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
4202
+
4203
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
4204
+ expect(root_child0_child2.getComputedTop()).toBe(100)
4205
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4206
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
4207
+
4208
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4209
+
4210
+ expect(root.getComputedLeft()).toBe(0)
4211
+ expect(root.getComputedTop()).toBe(0)
4212
+ expect(root.getComputedWidth()).toBe(100)
4213
+ expect(root.getComputedHeight()).toBe(100)
4214
+
4215
+ expect(root_child0.getComputedLeft()).toBe(0)
4216
+ expect(root_child0.getComputedTop()).toBe(0)
4217
+ expect(root_child0.getComputedWidth()).toBe(100)
4218
+ expect(root_child0.getComputedHeight()).toBe(100)
4219
+
4220
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
4221
+ expect(root_child0_child0.getComputedTop()).toBe(90)
4222
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4223
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4224
+
4225
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
4226
+ expect(root_child0_child1.getComputedTop()).toBe(100)
4227
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4228
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
4229
+
4230
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
4231
+ expect(root_child0_child2.getComputedTop()).toBe(100)
4232
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4233
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
4234
+ } finally {
4235
+ if (typeof root !== "undefined") {
4236
+ root.freeRecursive()
4237
+ }
4238
+
4239
+ config.free()
4240
+ }
4241
+ })
4242
+ test("flex_direction_col_reverse_inner_padding_bottom", () => {
4243
+ const config = Yoga.Config.create()
4244
+ let root
4245
+
4246
+ try {
4247
+ root = Yoga.Node.create(config)
4248
+ root.setPositionType(PositionType.Absolute)
4249
+ root.setWidth(100)
4250
+ root.setHeight(100)
4251
+
4252
+ const root_child0 = Yoga.Node.create(config)
4253
+ root_child0.setFlexDirection(FlexDirection.ColumnReverse)
4254
+ root_child0.setWidth(100)
4255
+ root_child0.setHeight(100)
4256
+ root.insertChild(root_child0, 0)
4257
+
4258
+ const root_child0_child0 = Yoga.Node.create(config)
4259
+ root_child0_child0.setPositionType(PositionType.Absolute)
4260
+ root_child0_child0.setPadding(Edge.Bottom, 10)
4261
+ root_child0_child0.setWidth(10)
4262
+ root_child0_child0.setHeight(10)
4263
+ root_child0.insertChild(root_child0_child0, 0)
4264
+
4265
+ const root_child0_child1 = Yoga.Node.create(config)
4266
+ root_child0_child1.setWidth(10)
4267
+ root_child0.insertChild(root_child0_child1, 1)
4268
+
4269
+ const root_child0_child2 = Yoga.Node.create(config)
4270
+ root_child0_child2.setWidth(10)
4271
+ root_child0.insertChild(root_child0_child2, 2)
4272
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4273
+
4274
+ expect(root.getComputedLeft()).toBe(0)
4275
+ expect(root.getComputedTop()).toBe(0)
4276
+ expect(root.getComputedWidth()).toBe(100)
4277
+ expect(root.getComputedHeight()).toBe(100)
4278
+
4279
+ expect(root_child0.getComputedLeft()).toBe(0)
4280
+ expect(root_child0.getComputedTop()).toBe(0)
4281
+ expect(root_child0.getComputedWidth()).toBe(100)
4282
+ expect(root_child0.getComputedHeight()).toBe(100)
4283
+
4284
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
4285
+ expect(root_child0_child0.getComputedTop()).toBe(90)
4286
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4287
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4288
+
4289
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
4290
+ expect(root_child0_child1.getComputedTop()).toBe(100)
4291
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4292
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
4293
+
4294
+ expect(root_child0_child2.getComputedLeft()).toBe(0)
4295
+ expect(root_child0_child2.getComputedTop()).toBe(100)
4296
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4297
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
4298
+
4299
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4300
+
4301
+ expect(root.getComputedLeft()).toBe(0)
4302
+ expect(root.getComputedTop()).toBe(0)
4303
+ expect(root.getComputedWidth()).toBe(100)
4304
+ expect(root.getComputedHeight()).toBe(100)
4305
+
4306
+ expect(root_child0.getComputedLeft()).toBe(0)
4307
+ expect(root_child0.getComputedTop()).toBe(0)
4308
+ expect(root_child0.getComputedWidth()).toBe(100)
4309
+ expect(root_child0.getComputedHeight()).toBe(100)
4310
+
4311
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
4312
+ expect(root_child0_child0.getComputedTop()).toBe(90)
4313
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4314
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4315
+
4316
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
4317
+ expect(root_child0_child1.getComputedTop()).toBe(100)
4318
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4319
+ expect(root_child0_child1.getComputedHeight()).toBe(0)
4320
+
4321
+ expect(root_child0_child2.getComputedLeft()).toBe(90)
4322
+ expect(root_child0_child2.getComputedTop()).toBe(100)
4323
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4324
+ expect(root_child0_child2.getComputedHeight()).toBe(0)
4325
+ } finally {
4326
+ if (typeof root !== "undefined") {
4327
+ root.freeRecursive()
4328
+ }
4329
+
4330
+ config.free()
4331
+ }
4332
+ })
4333
+ test("flex_direction_row_reverse_inner_padding_start", () => {
4334
+ const config = Yoga.Config.create()
4335
+ let root
4336
+
4337
+ try {
4338
+ root = Yoga.Node.create(config)
4339
+ root.setPositionType(PositionType.Absolute)
4340
+ root.setWidth(100)
4341
+ root.setHeight(100)
4342
+
4343
+ const root_child0 = Yoga.Node.create(config)
4344
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
4345
+ root_child0.setWidth(100)
4346
+ root_child0.setHeight(100)
4347
+ root.insertChild(root_child0, 0)
4348
+
4349
+ const root_child0_child0 = Yoga.Node.create(config)
4350
+ root_child0_child0.setPositionType(PositionType.Absolute)
4351
+ root_child0_child0.setPadding(Edge.Start, 10)
4352
+ root_child0_child0.setWidth(10)
4353
+ root_child0_child0.setHeight(10)
4354
+ root_child0.insertChild(root_child0_child0, 0)
4355
+
4356
+ const root_child0_child1 = Yoga.Node.create(config)
4357
+ root_child0_child1.setWidth(10)
4358
+ root_child0.insertChild(root_child0_child1, 1)
4359
+
4360
+ const root_child0_child2 = Yoga.Node.create(config)
4361
+ root_child0_child2.setWidth(10)
4362
+ root_child0.insertChild(root_child0_child2, 2)
4363
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4364
+
4365
+ expect(root.getComputedLeft()).toBe(0)
4366
+ expect(root.getComputedTop()).toBe(0)
4367
+ expect(root.getComputedWidth()).toBe(100)
4368
+ expect(root.getComputedHeight()).toBe(100)
4369
+
4370
+ expect(root_child0.getComputedLeft()).toBe(0)
4371
+ expect(root_child0.getComputedTop()).toBe(0)
4372
+ expect(root_child0.getComputedWidth()).toBe(100)
4373
+ expect(root_child0.getComputedHeight()).toBe(100)
4374
+
4375
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
4376
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4377
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4378
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4379
+
4380
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
4381
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4382
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4383
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4384
+
4385
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
4386
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4387
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4388
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4389
+
4390
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4391
+
4392
+ expect(root.getComputedLeft()).toBe(0)
4393
+ expect(root.getComputedTop()).toBe(0)
4394
+ expect(root.getComputedWidth()).toBe(100)
4395
+ expect(root.getComputedHeight()).toBe(100)
4396
+
4397
+ expect(root_child0.getComputedLeft()).toBe(0)
4398
+ expect(root_child0.getComputedTop()).toBe(0)
4399
+ expect(root_child0.getComputedWidth()).toBe(100)
4400
+ expect(root_child0.getComputedHeight()).toBe(100)
4401
+
4402
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
4403
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4404
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4405
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4406
+
4407
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
4408
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4409
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4410
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4411
+
4412
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
4413
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4414
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4415
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4416
+ } finally {
4417
+ if (typeof root !== "undefined") {
4418
+ root.freeRecursive()
4419
+ }
4420
+
4421
+ config.free()
4422
+ }
4423
+ })
4424
+ test("flex_direction_row_reverse_inner_padding_end", () => {
4425
+ const config = Yoga.Config.create()
4426
+ let root
4427
+
4428
+ try {
4429
+ root = Yoga.Node.create(config)
4430
+ root.setPositionType(PositionType.Absolute)
4431
+ root.setWidth(100)
4432
+ root.setHeight(100)
4433
+
4434
+ const root_child0 = Yoga.Node.create(config)
4435
+ root_child0.setFlexDirection(FlexDirection.RowReverse)
4436
+ root_child0.setWidth(100)
4437
+ root_child0.setHeight(100)
4438
+ root.insertChild(root_child0, 0)
4439
+
4440
+ const root_child0_child0 = Yoga.Node.create(config)
4441
+ root_child0_child0.setPositionType(PositionType.Absolute)
4442
+ root_child0_child0.setPadding(Edge.End, 10)
4443
+ root_child0_child0.setWidth(10)
4444
+ root_child0_child0.setHeight(10)
4445
+ root_child0.insertChild(root_child0_child0, 0)
4446
+
4447
+ const root_child0_child1 = Yoga.Node.create(config)
4448
+ root_child0_child1.setWidth(10)
4449
+ root_child0.insertChild(root_child0_child1, 1)
4450
+
4451
+ const root_child0_child2 = Yoga.Node.create(config)
4452
+ root_child0_child2.setWidth(10)
4453
+ root_child0.insertChild(root_child0_child2, 2)
4454
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4455
+
4456
+ expect(root.getComputedLeft()).toBe(0)
4457
+ expect(root.getComputedTop()).toBe(0)
4458
+ expect(root.getComputedWidth()).toBe(100)
4459
+ expect(root.getComputedHeight()).toBe(100)
4460
+
4461
+ expect(root_child0.getComputedLeft()).toBe(0)
4462
+ expect(root_child0.getComputedTop()).toBe(0)
4463
+ expect(root_child0.getComputedWidth()).toBe(100)
4464
+ expect(root_child0.getComputedHeight()).toBe(100)
4465
+
4466
+ expect(root_child0_child0.getComputedLeft()).toBe(90)
4467
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4468
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4469
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4470
+
4471
+ expect(root_child0_child1.getComputedLeft()).toBe(90)
4472
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4473
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4474
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4475
+
4476
+ expect(root_child0_child2.getComputedLeft()).toBe(80)
4477
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4478
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4479
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4480
+
4481
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4482
+
4483
+ expect(root.getComputedLeft()).toBe(0)
4484
+ expect(root.getComputedTop()).toBe(0)
4485
+ expect(root.getComputedWidth()).toBe(100)
4486
+ expect(root.getComputedHeight()).toBe(100)
4487
+
4488
+ expect(root_child0.getComputedLeft()).toBe(0)
4489
+ expect(root_child0.getComputedTop()).toBe(0)
4490
+ expect(root_child0.getComputedWidth()).toBe(100)
4491
+ expect(root_child0.getComputedHeight()).toBe(100)
4492
+
4493
+ expect(root_child0_child0.getComputedLeft()).toBe(0)
4494
+ expect(root_child0_child0.getComputedTop()).toBe(0)
4495
+ expect(root_child0_child0.getComputedWidth()).toBe(10)
4496
+ expect(root_child0_child0.getComputedHeight()).toBe(10)
4497
+
4498
+ expect(root_child0_child1.getComputedLeft()).toBe(0)
4499
+ expect(root_child0_child1.getComputedTop()).toBe(0)
4500
+ expect(root_child0_child1.getComputedWidth()).toBe(10)
4501
+ expect(root_child0_child1.getComputedHeight()).toBe(100)
4502
+
4503
+ expect(root_child0_child2.getComputedLeft()).toBe(10)
4504
+ expect(root_child0_child2.getComputedTop()).toBe(0)
4505
+ expect(root_child0_child2.getComputedWidth()).toBe(10)
4506
+ expect(root_child0_child2.getComputedHeight()).toBe(100)
4507
+ } finally {
4508
+ if (typeof root !== "undefined") {
4509
+ root.freeRecursive()
4510
+ }
4511
+
4512
+ config.free()
4513
+ }
4514
+ })
4515
+ test("flex_direction_alternating_with_percent", () => {
4516
+ const config = Yoga.Config.create()
4517
+ let root
4518
+
4519
+ try {
4520
+ root = Yoga.Node.create(config)
4521
+ root.setPositionType(PositionType.Absolute)
4522
+ root.setWidth(200)
4523
+ root.setHeight(300)
4524
+
4525
+ const root_child0 = Yoga.Node.create(config)
4526
+ root_child0.setFlexDirection(FlexDirection.Row)
4527
+ root_child0.setPosition(Edge.Left, "10%")
4528
+ root_child0.setPosition(Edge.Top, "10%")
4529
+ root_child0.setWidth("50%")
4530
+ root_child0.setHeight("50%")
4531
+ root.insertChild(root_child0, 0)
4532
+ root.calculateLayout(undefined, undefined, Direction.LTR)
4533
+
4534
+ expect(root.getComputedLeft()).toBe(0)
4535
+ expect(root.getComputedTop()).toBe(0)
4536
+ expect(root.getComputedWidth()).toBe(200)
4537
+ expect(root.getComputedHeight()).toBe(300)
4538
+
4539
+ expect(root_child0.getComputedLeft()).toBe(20)
4540
+ expect(root_child0.getComputedTop()).toBe(30)
4541
+ expect(root_child0.getComputedWidth()).toBe(100)
4542
+ expect(root_child0.getComputedHeight()).toBe(150)
4543
+
4544
+ root.calculateLayout(undefined, undefined, Direction.RTL)
4545
+
4546
+ expect(root.getComputedLeft()).toBe(0)
4547
+ expect(root.getComputedTop()).toBe(0)
4548
+ expect(root.getComputedWidth()).toBe(200)
4549
+ expect(root.getComputedHeight()).toBe(300)
4550
+
4551
+ expect(root_child0.getComputedLeft()).toBe(120)
4552
+ expect(root_child0.getComputedTop()).toBe(30)
4553
+ expect(root_child0.getComputedWidth()).toBe(100)
4554
+ expect(root_child0.getComputedHeight()).toBe(150)
4555
+ } finally {
4556
+ if (typeof root !== "undefined") {
4557
+ root.freeRecursive()
4558
+ }
4559
+
4560
+ config.free()
4561
+ }
4562
+ })