@xincli/opentui-core 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (619) hide show
  1. package/LICENSE +21 -0
  2. package/NativeSpanFeed.d.ts +52 -0
  3. package/README.md +0 -0
  4. package/Renderable.d.ts +346 -0
  5. package/animation/Timeline.d.ts +126 -0
  6. package/ansi.d.ts +17 -0
  7. package/audio.d.ts +89 -0
  8. package/buffer.d.ts +113 -0
  9. package/console.d.ts +146 -0
  10. package/edit-buffer.d.ts +97 -0
  11. package/editor-view.d.ts +72 -0
  12. package/index-m1y9e40w.js +10045 -0
  13. package/index-m1y9e40w.js.map +32 -0
  14. package/index-sqk4ajdf.js +16121 -0
  15. package/index-sqk4ajdf.js.map +58 -0
  16. package/index.d.ts +24 -0
  17. package/index.js +11709 -0
  18. package/index.js.map +35 -0
  19. package/lib/KeyHandler.d.ts +61 -0
  20. package/lib/RGBA.d.ts +42 -0
  21. package/lib/ascii.font.d.ts +508 -0
  22. package/lib/border.d.ts +51 -0
  23. package/lib/bunfs.d.ts +7 -0
  24. package/lib/clipboard.d.ts +15 -0
  25. package/lib/clock.d.ts +15 -0
  26. package/lib/data-paths.d.ts +26 -0
  27. package/lib/debounce.d.ts +42 -0
  28. package/lib/detect-links.d.ts +6 -0
  29. package/lib/env.d.ts +42 -0
  30. package/lib/extmarks-history.d.ts +17 -0
  31. package/lib/extmarks.d.ts +90 -0
  32. package/lib/hast-styled-text.d.ts +17 -0
  33. package/lib/index.d.ts +22 -0
  34. package/lib/keybinding.internal.d.ts +33 -0
  35. package/lib/objects-in-viewport.d.ts +24 -0
  36. package/lib/output.capture.d.ts +24 -0
  37. package/lib/parse.keypress-kitty.d.ts +3 -0
  38. package/lib/parse.keypress.d.ts +27 -0
  39. package/lib/parse.mouse.d.ts +30 -0
  40. package/lib/paste.d.ts +7 -0
  41. package/lib/queue.d.ts +15 -0
  42. package/lib/render-geometry.d.ts +8 -0
  43. package/lib/renderable.validations.d.ts +12 -0
  44. package/lib/scroll-acceleration.d.ts +43 -0
  45. package/lib/selection.d.ts +64 -0
  46. package/lib/singleton.d.ts +8 -0
  47. package/lib/stdin-parser.d.ts +90 -0
  48. package/lib/styled-text.d.ts +63 -0
  49. package/lib/terminal-capability-detection.d.ts +32 -0
  50. package/lib/terminal-palette.d.ts +65 -0
  51. package/lib/tree-sitter/assets/update.d.ts +12 -0
  52. package/lib/tree-sitter/client.d.ts +65 -0
  53. package/lib/tree-sitter/default-parsers.d.ts +2 -0
  54. package/lib/tree-sitter/download-utils.d.ts +21 -0
  55. package/lib/tree-sitter/index.d.ts +7 -0
  56. package/lib/tree-sitter/parser.worker.d.ts +1 -0
  57. package/lib/tree-sitter/parsers-config.d.ts +53 -0
  58. package/lib/tree-sitter/resolve-ft.d.ts +5 -0
  59. package/lib/tree-sitter/types.d.ts +185 -0
  60. package/lib/tree-sitter/update-assets.d.ts +3 -0
  61. package/lib/tree-sitter/update-assets.js +379 -0
  62. package/lib/tree-sitter/update-assets.js.map +12 -0
  63. package/lib/tree-sitter-styled-text.d.ts +16 -0
  64. package/lib/validate-dir-name.d.ts +1 -0
  65. package/lib/yoga.options.d.ts +32 -0
  66. package/native-event-worker-repro.worker.d.ts +1 -0
  67. package/package.json +52 -74
  68. package/parser.worker.js +1399 -0
  69. package/parser.worker.js.map +20 -0
  70. package/platform/ffi.d.ts +129 -0
  71. package/platform/runtime.d.ts +14 -0
  72. package/platform/test.d.ts +12 -0
  73. package/platform/worker.d.ts +26 -0
  74. package/platform/worker.node-test.d.ts +1 -0
  75. package/plugins/core-slot.d.ts +72 -0
  76. package/plugins/registry.d.ts +42 -0
  77. package/plugins/types.d.ts +34 -0
  78. package/post/effects.d.ts +147 -0
  79. package/post/filters.d.ts +65 -0
  80. package/post/matrices.d.ts +20 -0
  81. package/renderables/ASCIIFont.d.ts +52 -0
  82. package/renderables/Box.d.ts +85 -0
  83. package/renderables/Code.d.ts +97 -0
  84. package/renderables/Diff.d.ts +147 -0
  85. package/renderables/EditBufferRenderable.d.ts +238 -0
  86. package/renderables/FrameBuffer.d.ts +16 -0
  87. package/renderables/Input.d.ts +72 -0
  88. package/renderables/LineNumberRenderable.d.ts +78 -0
  89. package/renderables/Markdown.d.ts +255 -0
  90. package/renderables/ScrollBar.d.ts +77 -0
  91. package/renderables/ScrollBox.d.ts +128 -0
  92. package/renderables/Select.d.ts +122 -0
  93. package/renderables/Slider.d.ts +47 -0
  94. package/renderables/TabSelect.d.ts +98 -0
  95. package/renderables/Text.d.ts +36 -0
  96. package/renderables/TextBufferRenderable.d.ts +107 -0
  97. package/renderables/TextNode.d.ts +92 -0
  98. package/renderables/TextTable.d.ts +154 -0
  99. package/renderables/Textarea.d.ts +65 -0
  100. package/renderables/TimeToFirstDraw.d.ts +24 -0
  101. package/renderables/__tests__/renderable-test-utils.d.ts +12 -0
  102. package/renderables/composition/VRenderable.d.ts +16 -0
  103. package/renderables/composition/constructs.d.ts +35 -0
  104. package/renderables/composition/vnode.d.ts +46 -0
  105. package/renderables/index.d.ts +23 -0
  106. package/renderables/markdown-parser.d.ts +11 -0
  107. package/renderer-theme-mode.d.ts +29 -0
  108. package/renderer.d.ts +601 -0
  109. package/runtime-plugin-support-configure.d.ts +4 -0
  110. package/runtime-plugin-support-configure.js +36 -0
  111. package/runtime-plugin-support-configure.js.map +1 -0
  112. package/runtime-plugin-support-configure.node.js +15 -0
  113. package/runtime-plugin-support.d.ts +3 -0
  114. package/runtime-plugin-support.js +5 -0
  115. package/runtime-plugin-support.js.map +1 -0
  116. package/runtime-plugin-support.node.js +15 -0
  117. package/runtime-plugin.d.ts +16 -0
  118. package/runtime-plugin.js +473 -0
  119. package/runtime-plugin.js.map +1 -0
  120. package/runtime-plugin.node.js +15 -0
  121. package/syntax-style.d.ts +61 -0
  122. package/testing/bun-test-node.d.ts +87 -0
  123. package/testing/manual-clock.d.ts +17 -0
  124. package/testing/mock-keys.d.ts +81 -0
  125. package/testing/mock-mouse.d.ts +38 -0
  126. package/testing/mock-tree-sitter-client.d.ts +27 -0
  127. package/testing/spy.d.ts +7 -0
  128. package/testing/terminal-capabilities.d.ts +7 -0
  129. package/testing/test-recorder.d.ts +61 -0
  130. package/testing/test-renderer.d.ts +54 -0
  131. package/testing/test-streams.d.ts +12 -0
  132. package/testing.d.ts +8 -0
  133. package/testing.js +1004 -0
  134. package/testing.js.map +18 -0
  135. package/tests/yoga-upstream/tools/MeasureCounter.d.ts +16 -0
  136. package/tests/yoga-upstream/tools/utils.d.ts +11 -0
  137. package/text-buffer-view.d.ts +42 -0
  138. package/text-buffer.d.ts +66 -0
  139. package/types.d.ts +175 -0
  140. package/utils.d.ts +14 -0
  141. package/yoga.d.ts +437 -0
  142. package/yoga.js +193 -0
  143. package/yoga.js.map +9 -0
  144. package/zig-structs.d.ts +256 -0
  145. package/zig.d.ts +496 -0
  146. package/dev/keypress-debug-renderer.ts +0 -148
  147. package/dev/keypress-debug.ts +0 -43
  148. package/dev/print-env-vars.ts +0 -32
  149. package/dev/test-tmux-graphics-334.sh +0 -68
  150. package/dev/test-tmux-theme-queries.sh +0 -151
  151. package/dev/thai-debug-test.ts +0 -68
  152. package/dev/theme-mode.ts +0 -290
  153. package/docs/development.md +0 -144
  154. package/prebuilt/aarch64-android/libopentui.so +0 -0
  155. package/scripts/build-android.ts +0 -226
  156. package/scripts/build-native-termux.sh +0 -525
  157. package/scripts/build.ts +0 -530
  158. package/scripts/dist-test.ts +0 -312
  159. package/scripts/package-prebuilt.ts +0 -110
  160. package/scripts/publish.ts +0 -60
  161. package/scripts/test-node-hook.mjs +0 -16
  162. package/scripts/test-node.ts +0 -241
  163. package/scripts/vendor-deps.sh +0 -73
  164. package/src/NativeSpanFeed.ts +0 -375
  165. package/src/Renderable.ts +0 -1878
  166. package/src/__snapshots__/buffer.test.ts.snap +0 -28
  167. package/src/animation/Timeline.test.ts +0 -2709
  168. package/src/animation/Timeline.ts +0 -598
  169. package/src/ansi.ts +0 -22
  170. package/src/audio.ts +0 -479
  171. package/src/benchmark/attenuation-benchmark.ts +0 -81
  172. package/src/benchmark/audio-playback-benchmark.ts +0 -344
  173. package/src/benchmark/box-draw-benchmark.ts +0 -1042
  174. package/src/benchmark/colormatrix-benchmark.ts +0 -123
  175. package/src/benchmark/gain-benchmark.ts +0 -80
  176. package/src/benchmark/latest-all-bench-run.json +0 -707
  177. package/src/benchmark/latest-async-bench-run.json +0 -336
  178. package/src/benchmark/latest-default-bench-run.json +0 -657
  179. package/src/benchmark/latest-large-bench-run.json +0 -707
  180. package/src/benchmark/latest-quick-bench-run.json +0 -207
  181. package/src/benchmark/layout-benchmark.ts +0 -2547
  182. package/src/benchmark/markdown-benchmark.ts +0 -1796
  183. package/src/benchmark/native-span-feed-async-benchmark.ts +0 -355
  184. package/src/benchmark/native-span-feed-benchmark.md +0 -56
  185. package/src/benchmark/native-span-feed-benchmark.ts +0 -596
  186. package/src/benchmark/native-span-feed-compare.ts +0 -280
  187. package/src/benchmark/render-traversal-benchmark.ts +0 -928
  188. package/src/benchmark/text-buffer-render-benchmark.ts +0 -874
  189. package/src/benchmark/text-table-benchmark.ts +0 -948
  190. package/src/buffer.test.ts +0 -292
  191. package/src/buffer.ts +0 -564
  192. package/src/console.test.ts +0 -629
  193. package/src/console.ts +0 -1253
  194. package/src/edit-buffer.test.ts +0 -1852
  195. package/src/edit-buffer.ts +0 -417
  196. package/src/editor-view.test.ts +0 -1056
  197. package/src/editor-view.ts +0 -290
  198. package/src/index.ts +0 -25
  199. package/src/lib/KeyHandler.integration.test.ts +0 -292
  200. package/src/lib/KeyHandler.stopPropagation.test.ts +0 -289
  201. package/src/lib/KeyHandler.test.ts +0 -662
  202. package/src/lib/KeyHandler.ts +0 -222
  203. package/src/lib/RGBA.test.ts +0 -60
  204. package/src/lib/RGBA.ts +0 -343
  205. package/src/lib/ascii.font.ts +0 -330
  206. package/src/lib/border.test.ts +0 -83
  207. package/src/lib/border.ts +0 -170
  208. package/src/lib/bunfs.test.ts +0 -27
  209. package/src/lib/bunfs.ts +0 -18
  210. package/src/lib/clipboard.test.ts +0 -63
  211. package/src/lib/clipboard.ts +0 -41
  212. package/src/lib/clock.ts +0 -35
  213. package/src/lib/data-paths.test.ts +0 -133
  214. package/src/lib/data-paths.ts +0 -109
  215. package/src/lib/debounce.ts +0 -106
  216. package/src/lib/detect-links.test.ts +0 -98
  217. package/src/lib/detect-links.ts +0 -56
  218. package/src/lib/env.test.ts +0 -228
  219. package/src/lib/env.ts +0 -209
  220. package/src/lib/extmarks-history.ts +0 -51
  221. package/src/lib/extmarks-multiwidth.test.ts +0 -324
  222. package/src/lib/extmarks.test.ts +0 -3547
  223. package/src/lib/extmarks.ts +0 -861
  224. package/src/lib/fonts/block.json +0 -405
  225. package/src/lib/fonts/grid.json +0 -265
  226. package/src/lib/fonts/huge.json +0 -741
  227. package/src/lib/fonts/pallet.json +0 -314
  228. package/src/lib/fonts/shade.json +0 -591
  229. package/src/lib/fonts/slick.json +0 -321
  230. package/src/lib/fonts/tiny.json +0 -69
  231. package/src/lib/hast-styled-text.ts +0 -59
  232. package/src/lib/index.ts +0 -22
  233. package/src/lib/keybinding.internal.test.ts +0 -342
  234. package/src/lib/keybinding.internal.ts +0 -182
  235. package/src/lib/objects-in-viewport.test.ts +0 -789
  236. package/src/lib/objects-in-viewport.ts +0 -153
  237. package/src/lib/output.capture.ts +0 -58
  238. package/src/lib/parse.keypress-kitty.protocol.test.ts +0 -347
  239. package/src/lib/parse.keypress-kitty.test.ts +0 -712
  240. package/src/lib/parse.keypress-kitty.ts +0 -470
  241. package/src/lib/parse.keypress.test.ts +0 -2020
  242. package/src/lib/parse.keypress.ts +0 -480
  243. package/src/lib/parse.mouse.test.ts +0 -552
  244. package/src/lib/parse.mouse.ts +0 -232
  245. package/src/lib/paste.ts +0 -18
  246. package/src/lib/queue.ts +0 -65
  247. package/src/lib/render-geometry.ts +0 -36
  248. package/src/lib/renderable.validations.test.ts +0 -87
  249. package/src/lib/renderable.validations.ts +0 -83
  250. package/src/lib/scroll-acceleration.ts +0 -98
  251. package/src/lib/selection.ts +0 -261
  252. package/src/lib/singleton.ts +0 -34
  253. package/src/lib/stdin-parser.test.ts +0 -2439
  254. package/src/lib/stdin-parser.ts +0 -2007
  255. package/src/lib/styled-text.ts +0 -178
  256. package/src/lib/terminal-capability-detection.test.ts +0 -226
  257. package/src/lib/terminal-capability-detection.ts +0 -98
  258. package/src/lib/terminal-palette.test.ts +0 -954
  259. package/src/lib/terminal-palette.ts +0 -441
  260. package/src/lib/tree-sitter/assets/README.md +0 -119
  261. package/src/lib/tree-sitter/assets/update.ts +0 -360
  262. package/src/lib/tree-sitter/assets.d.ts +0 -9
  263. package/src/lib/tree-sitter/cache.test.ts +0 -291
  264. package/src/lib/tree-sitter/client.test.ts +0 -1434
  265. package/src/lib/tree-sitter/client.ts +0 -847
  266. package/src/lib/tree-sitter/default-parsers.ts +0 -133
  267. package/src/lib/tree-sitter/download-utils.ts +0 -148
  268. package/src/lib/tree-sitter/index.ts +0 -75
  269. package/src/lib/tree-sitter/parser.worker.ts +0 -1098
  270. package/src/lib/tree-sitter/parsers-config.ts +0 -81
  271. package/src/lib/tree-sitter/resolve-ft.test.ts +0 -55
  272. package/src/lib/tree-sitter/resolve-ft.ts +0 -189
  273. package/src/lib/tree-sitter/types.ts +0 -132
  274. package/src/lib/tree-sitter/update-assets.ts +0 -10
  275. package/src/lib/tree-sitter-styled-text.test.ts +0 -1253
  276. package/src/lib/tree-sitter-styled-text.ts +0 -314
  277. package/src/lib/validate-dir-name.ts +0 -55
  278. package/src/lib/yoga.options.test.ts +0 -628
  279. package/src/lib/yoga.options.ts +0 -346
  280. package/src/native-event-worker-repro.test.ts +0 -48
  281. package/src/native-event-worker-repro.worker.ts +0 -9
  282. package/src/native-handle.test.ts +0 -221
  283. package/src/platform/ffi.test.ts +0 -516
  284. package/src/platform/ffi.ts +0 -653
  285. package/src/platform/runtime.test.ts +0 -52
  286. package/src/platform/runtime.ts +0 -121
  287. package/src/platform/test.ts +0 -45
  288. package/src/platform/worker-handler-cleanup.fixture.ts +0 -12
  289. package/src/platform/worker-onmessage-startup.fixture.ts +0 -10
  290. package/src/platform/worker-startup.fixture.ts +0 -9
  291. package/src/platform/worker.node-test.ts +0 -153
  292. package/src/platform/worker.ts +0 -425
  293. package/src/plugins/core-slot.ts +0 -579
  294. package/src/plugins/registry.ts +0 -402
  295. package/src/plugins/types.ts +0 -46
  296. package/src/post/effects.ts +0 -948
  297. package/src/post/filters.ts +0 -512
  298. package/src/post/matrices.ts +0 -288
  299. package/src/renderables/ASCIIFont.ts +0 -219
  300. package/src/renderables/Box.test.ts +0 -474
  301. package/src/renderables/Box.ts +0 -353
  302. package/src/renderables/Code.test.ts +0 -2388
  303. package/src/renderables/Code.ts +0 -555
  304. package/src/renderables/Diff.regression.test.ts +0 -381
  305. package/src/renderables/Diff.test.ts +0 -3212
  306. package/src/renderables/Diff.ts +0 -1278
  307. package/src/renderables/EditBufferRenderable.test.ts +0 -288
  308. package/src/renderables/EditBufferRenderable.ts +0 -1152
  309. package/src/renderables/FrameBuffer.ts +0 -47
  310. package/src/renderables/Input.test.ts +0 -1310
  311. package/src/renderables/Input.ts +0 -273
  312. package/src/renderables/LineNumberRenderable.ts +0 -725
  313. package/src/renderables/Markdown.ts +0 -2144
  314. package/src/renderables/ScrollBar.ts +0 -423
  315. package/src/renderables/ScrollBox.ts +0 -903
  316. package/src/renderables/Select.test.ts +0 -1134
  317. package/src/renderables/Select.ts +0 -535
  318. package/src/renderables/Slider.test.ts +0 -456
  319. package/src/renderables/Slider.ts +0 -342
  320. package/src/renderables/TabSelect.test.ts +0 -238
  321. package/src/renderables/TabSelect.ts +0 -447
  322. package/src/renderables/Text.selection-buffer.test.ts +0 -118
  323. package/src/renderables/Text.test.ts +0 -2662
  324. package/src/renderables/Text.ts +0 -147
  325. package/src/renderables/TextBufferRenderable.ts +0 -504
  326. package/src/renderables/TextNode.test.ts +0 -1137
  327. package/src/renderables/TextNode.ts +0 -379
  328. package/src/renderables/TextTable.test.ts +0 -1411
  329. package/src/renderables/TextTable.ts +0 -1434
  330. package/src/renderables/Textarea.ts +0 -425
  331. package/src/renderables/TimeToFirstDraw.ts +0 -89
  332. package/src/renderables/__snapshots__/Code.test.ts.snap +0 -13
  333. package/src/renderables/__snapshots__/Diff.test.ts.snap +0 -785
  334. package/src/renderables/__snapshots__/Text.test.ts.snap +0 -421
  335. package/src/renderables/__snapshots__/TextTable.test.ts.snap +0 -215
  336. package/src/renderables/__tests__/Code.test.ts +0 -55
  337. package/src/renderables/__tests__/LineNumberRenderable.scrollbox-simple.test.ts +0 -144
  338. package/src/renderables/__tests__/LineNumberRenderable.scrollbox.test.ts +0 -827
  339. package/src/renderables/__tests__/LineNumberRenderable.test.ts +0 -1906
  340. package/src/renderables/__tests__/LineNumberRenderable.wrapping.test.ts +0 -85
  341. package/src/renderables/__tests__/Markdown.code-colors.test.ts +0 -288
  342. package/src/renderables/__tests__/Markdown.test.ts +0 -4175
  343. package/src/renderables/__tests__/MultiRenderable.selection.test.ts +0 -87
  344. package/src/renderables/__tests__/Textarea.buffer.test.ts +0 -683
  345. package/src/renderables/__tests__/Textarea.destroyed-events.test.ts +0 -675
  346. package/src/renderables/__tests__/Textarea.editing.test.ts +0 -2120
  347. package/src/renderables/__tests__/Textarea.error-handling.test.ts +0 -35
  348. package/src/renderables/__tests__/Textarea.events.test.ts +0 -738
  349. package/src/renderables/__tests__/Textarea.highlights.test.ts +0 -590
  350. package/src/renderables/__tests__/Textarea.keybinding.test.ts +0 -3275
  351. package/src/renderables/__tests__/Textarea.paste.test.ts +0 -357
  352. package/src/renderables/__tests__/Textarea.rendering.test.ts +0 -1927
  353. package/src/renderables/__tests__/Textarea.scroll.test.ts +0 -733
  354. package/src/renderables/__tests__/Textarea.selection.test.ts +0 -1589
  355. package/src/renderables/__tests__/Textarea.stress.test.ts +0 -670
  356. package/src/renderables/__tests__/Textarea.undo-redo.test.ts +0 -383
  357. package/src/renderables/__tests__/Textarea.visual-lines.test.ts +0 -310
  358. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.code.test.ts.snap +0 -221
  359. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox-simple.test.ts.snap +0 -89
  360. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox.test.ts.snap +0 -457
  361. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.test.ts.snap +0 -158
  362. package/src/renderables/__tests__/__snapshots__/Textarea.rendering.test.ts.snap +0 -387
  363. package/src/renderables/__tests__/markdown-parser.test.ts +0 -241
  364. package/src/renderables/__tests__/renderable-test-utils.ts +0 -60
  365. package/src/renderables/composition/README.md +0 -8
  366. package/src/renderables/composition/VRenderable.ts +0 -32
  367. package/src/renderables/composition/constructs.ts +0 -127
  368. package/src/renderables/composition/vnode.ts +0 -277
  369. package/src/renderables/index.ts +0 -23
  370. package/src/renderables/markdown-parser.ts +0 -79
  371. package/src/renderer-theme-mode.ts +0 -199
  372. package/src/renderer.ts +0 -4975
  373. package/src/runtime-plugin-support-configure.ts +0 -63
  374. package/src/runtime-plugin-support.ts +0 -13
  375. package/src/runtime-plugin.ts +0 -626
  376. package/src/specs/terminal-startup.md +0 -64
  377. package/src/syntax-style.test.ts +0 -841
  378. package/src/syntax-style.ts +0 -274
  379. package/src/testing/README.md +0 -219
  380. package/src/testing/bun-test-node.ts +0 -880
  381. package/src/testing/capture-spans.test.ts +0 -216
  382. package/src/testing/integration.test.ts +0 -276
  383. package/src/testing/manual-clock.ts +0 -117
  384. package/src/testing/mock-keys.test.ts +0 -1378
  385. package/src/testing/mock-keys.ts +0 -457
  386. package/src/testing/mock-mouse.test.ts +0 -218
  387. package/src/testing/mock-mouse.ts +0 -247
  388. package/src/testing/mock-tree-sitter-client.ts +0 -81
  389. package/src/testing/spy.ts +0 -13
  390. package/src/testing/terminal-capabilities.ts +0 -47
  391. package/src/testing/test-recorder.test.ts +0 -410
  392. package/src/testing/test-recorder.ts +0 -133
  393. package/src/testing/test-renderer.ts +0 -375
  394. package/src/testing/test-renderer.wait.test.ts +0 -278
  395. package/src/testing/test-streams.ts +0 -31
  396. package/src/testing.ts +0 -9
  397. package/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap +0 -481
  398. package/src/tests/__snapshots__/renderable.snapshot.test.ts.snap +0 -19
  399. package/src/tests/__snapshots__/scrollbox.test.ts.snap +0 -29
  400. package/src/tests/absolute-positioning.snapshot.test.ts +0 -638
  401. package/src/tests/allocator-stats.test.ts +0 -53
  402. package/src/tests/audio.test.ts +0 -303
  403. package/src/tests/destroy-during-render.test.ts +0 -200
  404. package/src/tests/destroy-on-exit.fixture.ts +0 -36
  405. package/src/tests/destroy-on-exit.test.ts +0 -62
  406. package/src/tests/ffi-borrowed-pointer-callsites.test.ts +0 -153
  407. package/src/tests/hover-cursor.test.ts +0 -98
  408. package/src/tests/native-backed-measurement-lifecycle.test.ts +0 -133
  409. package/src/tests/native-backed-measurement-parity.test.ts +0 -322
  410. package/src/tests/native-span-feed-async.test.ts +0 -173
  411. package/src/tests/native-span-feed-close.test.ts +0 -120
  412. package/src/tests/native-span-feed-coverage.test.ts +0 -227
  413. package/src/tests/native-span-feed-edge-cases.test.ts +0 -384
  414. package/src/tests/native-span-feed-use-after-free.test.ts +0 -45
  415. package/src/tests/opacity.test.ts +0 -123
  416. package/src/tests/renderable.snapshot.test.ts +0 -524
  417. package/src/tests/renderable.test.ts +0 -1851
  418. package/src/tests/renderer.clock.test.ts +0 -270
  419. package/src/tests/renderer.console-startup.test.ts +0 -2151
  420. package/src/tests/renderer.control.test.ts +0 -458
  421. package/src/tests/renderer.core-slot-binding.test.ts +0 -962
  422. package/src/tests/renderer.cursor.test.ts +0 -26
  423. package/src/tests/renderer.custom-stdout.test.ts +0 -1112
  424. package/src/tests/renderer.destroy-during-render.test.ts +0 -147
  425. package/src/tests/renderer.focus-restore.test.ts +0 -257
  426. package/src/tests/renderer.focus.test.ts +0 -329
  427. package/src/tests/renderer.idle.test.ts +0 -219
  428. package/src/tests/renderer.input.test.ts +0 -2615
  429. package/src/tests/renderer.kitty-flags.test.ts +0 -195
  430. package/src/tests/renderer.lifecycle.test.ts +0 -34
  431. package/src/tests/renderer.mouse.test.ts +0 -1315
  432. package/src/tests/renderer.notifications.test.ts +0 -27
  433. package/src/tests/renderer.palette.test.ts +0 -1199
  434. package/src/tests/renderer.remote.test.ts +0 -247
  435. package/src/tests/renderer.render-stats.test.ts +0 -146
  436. package/src/tests/renderer.scrollback-surface.test.ts +0 -474
  437. package/src/tests/renderer.selection.test.ts +0 -138
  438. package/src/tests/renderer.slot-registry.test.ts +0 -684
  439. package/src/tests/renderer.tracker.test.ts +0 -202
  440. package/src/tests/renderer.useMouse.test.ts +0 -83
  441. package/src/tests/runtime-plugin-node-modules-cycle.fixture.ts +0 -76
  442. package/src/tests/runtime-plugin-node-modules-import-like-string.fixture.ts +0 -48
  443. package/src/tests/runtime-plugin-node-modules-mjs.fixture.ts +0 -43
  444. package/src/tests/runtime-plugin-node-modules-no-bare-rewrite.fixture.ts +0 -67
  445. package/src/tests/runtime-plugin-node-modules-package-type-cache.fixture.ts +0 -72
  446. package/src/tests/runtime-plugin-node-modules-runtime-specifier.fixture.ts +0 -44
  447. package/src/tests/runtime-plugin-node-modules-scoped-package-bare-rewrite.fixture.ts +0 -85
  448. package/src/tests/runtime-plugin-path-alias.fixture.ts +0 -43
  449. package/src/tests/runtime-plugin-resolve-roots.fixture.ts +0 -65
  450. package/src/tests/runtime-plugin-support-configure.fixture.ts +0 -31
  451. package/src/tests/runtime-plugin-support-late-addition.fixture.ts +0 -17
  452. package/src/tests/runtime-plugin-support.fixture.ts +0 -11
  453. package/src/tests/runtime-plugin-support.test.ts +0 -54
  454. package/src/tests/runtime-plugin-windows-file-url.fixture.ts +0 -30
  455. package/src/tests/runtime-plugin.fixture.ts +0 -40
  456. package/src/tests/runtime-plugin.test.ts +0 -369
  457. package/src/tests/scrollbox-culling-bug.test.ts +0 -114
  458. package/src/tests/scrollbox-hitgrid-resize.test.ts +0 -136
  459. package/src/tests/scrollbox-hitgrid.test.ts +0 -909
  460. package/src/tests/scrollbox.test.ts +0 -1895
  461. package/src/tests/wrap-resize-perf.test.ts +0 -276
  462. package/src/tests/yoga-api-coverage.test.ts +0 -409
  463. package/src/tests/yoga-callback-stress.test.ts +0 -122
  464. package/src/tests/yoga-ffi.test.ts +0 -117
  465. package/src/tests/yoga-setters.test.ts +0 -921
  466. package/src/tests/yoga-upstream/YGAlignBaselineTest.test.ts +0 -124
  467. package/src/tests/yoga-upstream/YGComputedBorderTest.test.ts +0 -27
  468. package/src/tests/yoga-upstream/YGComputedMarginTest.test.ts +0 -27
  469. package/src/tests/yoga-upstream/YGComputedPaddingTest.test.ts +0 -27
  470. package/src/tests/yoga-upstream/YGDirtiedTest.test.ts +0 -157
  471. package/src/tests/yoga-upstream/YGErrataTest.test.ts +0 -40
  472. package/src/tests/yoga-upstream/YGFlexBasisAuto.test.ts +0 -23
  473. package/src/tests/yoga-upstream/YGHasNewLayout.test.ts +0 -81
  474. package/src/tests/yoga-upstream/YGMeasureCacheTest.test.ts +0 -31
  475. package/src/tests/yoga-upstream/YGMeasureTest.test.ts +0 -70
  476. package/src/tests/yoga-upstream/generated/YGAbsolutePositionTest.test.ts +0 -1864
  477. package/src/tests/yoga-upstream/generated/YGAlignContentTest.test.ts +0 -5829
  478. package/src/tests/yoga-upstream/generated/YGAlignItemsTest.test.ts +0 -2444
  479. package/src/tests/yoga-upstream/generated/YGAlignSelfTest.test.ts +0 -293
  480. package/src/tests/yoga-upstream/generated/YGAndroidNewsFeed.test.ts +0 -315
  481. package/src/tests/yoga-upstream/generated/YGAspectRatioTest.test.ts +0 -231
  482. package/src/tests/yoga-upstream/generated/YGAutoTest.test.ts +0 -347
  483. package/src/tests/yoga-upstream/generated/YGBorderTest.test.ts +0 -256
  484. package/src/tests/yoga-upstream/generated/YGBoxSizingTest.test.ts +0 -2747
  485. package/src/tests/yoga-upstream/generated/YGDimensionTest.test.ts +0 -129
  486. package/src/tests/yoga-upstream/generated/YGDisplayContentsTest.test.ts +0 -109
  487. package/src/tests/yoga-upstream/generated/YGDisplayTest.test.ts +0 -1097
  488. package/src/tests/yoga-upstream/generated/YGFlexDirectionTest.test.ts +0 -4562
  489. package/src/tests/yoga-upstream/generated/YGFlexTest.test.ts +0 -677
  490. package/src/tests/yoga-upstream/generated/YGFlexWrapTest.test.ts +0 -2071
  491. package/src/tests/yoga-upstream/generated/YGGapTest.test.ts +0 -3303
  492. package/src/tests/yoga-upstream/generated/YGIntrinsicSizeTest.test.ts +0 -582
  493. package/src/tests/yoga-upstream/generated/YGJustifyContentTest.test.ts +0 -2150
  494. package/src/tests/yoga-upstream/generated/YGMarginTest.test.ts +0 -1963
  495. package/src/tests/yoga-upstream/generated/YGMinMaxDimensionTest.test.ts +0 -1446
  496. package/src/tests/yoga-upstream/generated/YGPaddingTest.test.ts +0 -354
  497. package/src/tests/yoga-upstream/generated/YGPercentageTest.test.ts +0 -1760
  498. package/src/tests/yoga-upstream/generated/YGRoundingTest.test.ts +0 -1161
  499. package/src/tests/yoga-upstream/generated/YGSizeOverflowTest.test.ts +0 -207
  500. package/src/tests/yoga-upstream/generated/YGStaticPositionTest.test.ts +0 -6338
  501. package/src/tests/yoga-upstream/tools/MeasureCounter.ts +0 -54
  502. package/src/tests/yoga-upstream/tools/utils.ts +0 -81
  503. package/src/text-buffer-view.test.ts +0 -722
  504. package/src/text-buffer-view.ts +0 -193
  505. package/src/text-buffer.test.ts +0 -512
  506. package/src/text-buffer.ts +0 -250
  507. package/src/types.ts +0 -199
  508. package/src/utils.ts +0 -88
  509. package/src/yoga.ts +0 -1146
  510. package/src/zig/ansi.zig +0 -502
  511. package/src/zig/audio.zig +0 -1206
  512. package/src/zig/bench/README.md +0 -50
  513. package/src/zig/bench/buffer-color-blending_bench.zig +0 -350
  514. package/src/zig/bench/buffer-draw-box_bench.zig +0 -786
  515. package/src/zig/bench/buffer-draw-text-buffer_bench.zig +0 -894
  516. package/src/zig/bench/edit-buffer_bench.zig +0 -476
  517. package/src/zig/bench/editor-view_bench.zig +0 -169
  518. package/src/zig/bench/native-span-feed_bench.zig +0 -107
  519. package/src/zig/bench/rope-markers_bench.zig +0 -713
  520. package/src/zig/bench/rope_bench.zig +0 -514
  521. package/src/zig/bench/styled-text_bench.zig +0 -476
  522. package/src/zig/bench/text-buffer-coords_bench.zig +0 -362
  523. package/src/zig/bench/text-buffer-view_bench.zig +0 -459
  524. package/src/zig/bench/text-chunk-graphemes_bench.zig +0 -272
  525. package/src/zig/bench/utf8_bench.zig +0 -799
  526. package/src/zig/bench-utils.zig +0 -431
  527. package/src/zig/bench.zig +0 -223
  528. package/src/zig/buffer-methods.zig +0 -215
  529. package/src/zig/buffer.zig +0 -2515
  530. package/src/zig/build.zig +0 -700
  531. package/src/zig/build.zig.zon +0 -19
  532. package/src/zig/edit-buffer.zig +0 -900
  533. package/src/zig/editor-view.zig +0 -812
  534. package/src/zig/event-bus.zig +0 -28
  535. package/src/zig/event-emitter.zig +0 -65
  536. package/src/zig/file-logger.zig +0 -92
  537. package/src/zig/grapheme.zig +0 -838
  538. package/src/zig/handles.zig +0 -267
  539. package/src/zig/lib.zig +0 -2813
  540. package/src/zig/link.zig +0 -349
  541. package/src/zig/logger.zig +0 -43
  542. package/src/zig/mem-registry.zig +0 -126
  543. package/src/zig/miniaudio_shim.c +0 -21
  544. package/src/zig/native-renderable.zig +0 -112
  545. package/src/zig/native-span-feed-bench-lib.zig +0 -7
  546. package/src/zig/native-span-feed.zig +0 -747
  547. package/src/zig/renderer-output.zig +0 -677
  548. package/src/zig/renderer.zig +0 -2106
  549. package/src/zig/rope.zig +0 -1220
  550. package/src/zig/split-scrollback.zig +0 -88
  551. package/src/zig/syntax-style.zig +0 -174
  552. package/src/zig/terminal.zig +0 -1652
  553. package/src/zig/test.zig +0 -82
  554. package/src/zig/tests/README.md +0 -18
  555. package/src/zig/tests/ansi_test.zig +0 -18
  556. package/src/zig/tests/audio_test.zig +0 -439
  557. package/src/zig/tests/buffer-methods_test.zig +0 -1111
  558. package/src/zig/tests/buffer_test.zig +0 -2926
  559. package/src/zig/tests/edit-buffer-history_test.zig +0 -299
  560. package/src/zig/tests/edit-buffer_test.zig +0 -1688
  561. package/src/zig/tests/editor-view_test.zig +0 -3454
  562. package/src/zig/tests/event-emitter_test.zig +0 -249
  563. package/src/zig/tests/grapheme_test.zig +0 -1329
  564. package/src/zig/tests/handles_test.zig +0 -123
  565. package/src/zig/tests/link_test.zig +0 -220
  566. package/src/zig/tests/mem-registry_test.zig +0 -473
  567. package/src/zig/tests/memory_leak_regression_test.zig +0 -234
  568. package/src/zig/tests/native-renderable_test.zig +0 -16
  569. package/src/zig/tests/native-span-feed_test.zig +0 -1266
  570. package/src/zig/tests/renderer_test.zig +0 -2604
  571. package/src/zig/tests/rope-nested_test.zig +0 -712
  572. package/src/zig/tests/rope_fuzz_test.zig +0 -238
  573. package/src/zig/tests/rope_test.zig +0 -2362
  574. package/src/zig/tests/segment-merge.test.zig +0 -148
  575. package/src/zig/tests/split-scrollback_test.zig +0 -70
  576. package/src/zig/tests/syntax-style_test.zig +0 -558
  577. package/src/zig/tests/terminal_test.zig +0 -1489
  578. package/src/zig/tests/test-renderer.zig +0 -126
  579. package/src/zig/tests/text-buffer-drawing_test.zig +0 -3291
  580. package/src/zig/tests/text-buffer-highlights_test.zig +0 -706
  581. package/src/zig/tests/text-buffer-iterators_test.zig +0 -776
  582. package/src/zig/tests/text-buffer-segment_test.zig +0 -320
  583. package/src/zig/tests/text-buffer-selection_test.zig +0 -1056
  584. package/src/zig/tests/text-buffer-selection_viewport_test.zig +0 -358
  585. package/src/zig/tests/text-buffer-view_test.zig +0 -3672
  586. package/src/zig/tests/text-buffer_test.zig +0 -2191
  587. package/src/zig/tests/unicode-width-map.zon +0 -3909
  588. package/src/zig/tests/utf8_no_zwj_test.zig +0 -260
  589. package/src/zig/tests/utf8_test.zig +0 -4060
  590. package/src/zig/tests/utf8_wcwidth_cursor_test.zig +0 -267
  591. package/src/zig/tests/utf8_wcwidth_test.zig +0 -357
  592. package/src/zig/tests/word-wrap-editing_test.zig +0 -498
  593. package/src/zig/tests/wrap-cache-perf_test.zig +0 -113
  594. package/src/zig/tests/yoga_test.zig +0 -65
  595. package/src/zig/text-buffer-iterators.zig +0 -496
  596. package/src/zig/text-buffer-segment.zig +0 -403
  597. package/src/zig/text-buffer-view.zig +0 -1428
  598. package/src/zig/text-buffer.zig +0 -1272
  599. package/src/zig/utf8.zig +0 -1954
  600. package/src/zig/utils.zig +0 -12
  601. package/src/zig/uucode-stub.zig +0 -76
  602. package/src/zig/vendor/miniaudio/miniaudio.h +0 -93468
  603. package/src/zig/yoga.zig +0 -658
  604. package/src/zig-structs.ts +0 -381
  605. package/src/zig.ts +0 -5260
  606. package/tsconfig.build.json +0 -17
  607. package/tsconfig.json +0 -27
  608. package/tsconfig.node-test.json +0 -138
  609. /package/{src/lib/tree-sitter/assets → assets}/javascript/highlights.scm +0 -0
  610. /package/{src/lib/tree-sitter/assets → assets}/javascript/tree-sitter-javascript.wasm +0 -0
  611. /package/{src/lib/tree-sitter/assets → assets}/markdown/highlights.scm +0 -0
  612. /package/{src/lib/tree-sitter/assets → assets}/markdown/injections.scm +0 -0
  613. /package/{src/lib/tree-sitter/assets → assets}/markdown/tree-sitter-markdown.wasm +0 -0
  614. /package/{src/lib/tree-sitter/assets → assets}/markdown_inline/highlights.scm +0 -0
  615. /package/{src/lib/tree-sitter/assets → assets}/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
  616. /package/{src/lib/tree-sitter/assets → assets}/typescript/highlights.scm +0 -0
  617. /package/{src/lib/tree-sitter/assets → assets}/typescript/tree-sitter-typescript.wasm +0 -0
  618. /package/{src/lib/tree-sitter/assets → assets}/zig/highlights.scm +0 -0
  619. /package/{src/lib/tree-sitter/assets → assets}/zig/tree-sitter-zig.wasm +0 -0
@@ -1,1963 +0,0 @@
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<<3a4aaa192f950239104218a9666654c1>>
8
- * generated by gentest/gentest-driver.ts from gentest/fixtures/YGMarginTest.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("margin_start", () => {
32
- const config = Yoga.Config.create()
33
- let root
34
-
35
- try {
36
- root = Yoga.Node.create(config)
37
- root.setFlexDirection(FlexDirection.Row)
38
- root.setPositionType(PositionType.Absolute)
39
- root.setWidth(100)
40
- root.setHeight(100)
41
-
42
- const root_child0 = Yoga.Node.create(config)
43
- root_child0.setMargin(Edge.Start, 10)
44
- root_child0.setWidth(10)
45
- root.insertChild(root_child0, 0)
46
- root.calculateLayout(undefined, undefined, Direction.LTR)
47
-
48
- expect(root.getComputedLeft()).toBe(0)
49
- expect(root.getComputedTop()).toBe(0)
50
- expect(root.getComputedWidth()).toBe(100)
51
- expect(root.getComputedHeight()).toBe(100)
52
-
53
- expect(root_child0.getComputedLeft()).toBe(10)
54
- expect(root_child0.getComputedTop()).toBe(0)
55
- expect(root_child0.getComputedWidth()).toBe(10)
56
- expect(root_child0.getComputedHeight()).toBe(100)
57
-
58
- root.calculateLayout(undefined, undefined, Direction.RTL)
59
-
60
- expect(root.getComputedLeft()).toBe(0)
61
- expect(root.getComputedTop()).toBe(0)
62
- expect(root.getComputedWidth()).toBe(100)
63
- expect(root.getComputedHeight()).toBe(100)
64
-
65
- expect(root_child0.getComputedLeft()).toBe(80)
66
- expect(root_child0.getComputedTop()).toBe(0)
67
- expect(root_child0.getComputedWidth()).toBe(10)
68
- expect(root_child0.getComputedHeight()).toBe(100)
69
- } finally {
70
- if (typeof root !== "undefined") {
71
- root.freeRecursive()
72
- }
73
-
74
- config.free()
75
- }
76
- })
77
- test("margin_top", () => {
78
- const config = Yoga.Config.create()
79
- let root
80
-
81
- try {
82
- root = Yoga.Node.create(config)
83
- root.setPositionType(PositionType.Absolute)
84
- root.setWidth(100)
85
- root.setHeight(100)
86
-
87
- const root_child0 = Yoga.Node.create(config)
88
- root_child0.setMargin(Edge.Top, 10)
89
- root_child0.setHeight(10)
90
- root.insertChild(root_child0, 0)
91
- root.calculateLayout(undefined, undefined, Direction.LTR)
92
-
93
- expect(root.getComputedLeft()).toBe(0)
94
- expect(root.getComputedTop()).toBe(0)
95
- expect(root.getComputedWidth()).toBe(100)
96
- expect(root.getComputedHeight()).toBe(100)
97
-
98
- expect(root_child0.getComputedLeft()).toBe(0)
99
- expect(root_child0.getComputedTop()).toBe(10)
100
- expect(root_child0.getComputedWidth()).toBe(100)
101
- expect(root_child0.getComputedHeight()).toBe(10)
102
-
103
- root.calculateLayout(undefined, undefined, Direction.RTL)
104
-
105
- expect(root.getComputedLeft()).toBe(0)
106
- expect(root.getComputedTop()).toBe(0)
107
- expect(root.getComputedWidth()).toBe(100)
108
- expect(root.getComputedHeight()).toBe(100)
109
-
110
- expect(root_child0.getComputedLeft()).toBe(0)
111
- expect(root_child0.getComputedTop()).toBe(10)
112
- expect(root_child0.getComputedWidth()).toBe(100)
113
- expect(root_child0.getComputedHeight()).toBe(10)
114
- } finally {
115
- if (typeof root !== "undefined") {
116
- root.freeRecursive()
117
- }
118
-
119
- config.free()
120
- }
121
- })
122
- test("margin_end", () => {
123
- const config = Yoga.Config.create()
124
- let root
125
-
126
- try {
127
- root = Yoga.Node.create(config)
128
- root.setFlexDirection(FlexDirection.Row)
129
- root.setJustifyContent(Justify.FlexEnd)
130
- root.setPositionType(PositionType.Absolute)
131
- root.setWidth(100)
132
- root.setHeight(100)
133
-
134
- const root_child0 = Yoga.Node.create(config)
135
- root_child0.setMargin(Edge.End, 10)
136
- root_child0.setWidth(10)
137
- root.insertChild(root_child0, 0)
138
- root.calculateLayout(undefined, undefined, Direction.LTR)
139
-
140
- expect(root.getComputedLeft()).toBe(0)
141
- expect(root.getComputedTop()).toBe(0)
142
- expect(root.getComputedWidth()).toBe(100)
143
- expect(root.getComputedHeight()).toBe(100)
144
-
145
- expect(root_child0.getComputedLeft()).toBe(80)
146
- expect(root_child0.getComputedTop()).toBe(0)
147
- expect(root_child0.getComputedWidth()).toBe(10)
148
- expect(root_child0.getComputedHeight()).toBe(100)
149
-
150
- root.calculateLayout(undefined, undefined, Direction.RTL)
151
-
152
- expect(root.getComputedLeft()).toBe(0)
153
- expect(root.getComputedTop()).toBe(0)
154
- expect(root.getComputedWidth()).toBe(100)
155
- expect(root.getComputedHeight()).toBe(100)
156
-
157
- expect(root_child0.getComputedLeft()).toBe(10)
158
- expect(root_child0.getComputedTop()).toBe(0)
159
- expect(root_child0.getComputedWidth()).toBe(10)
160
- expect(root_child0.getComputedHeight()).toBe(100)
161
- } finally {
162
- if (typeof root !== "undefined") {
163
- root.freeRecursive()
164
- }
165
-
166
- config.free()
167
- }
168
- })
169
- test("margin_bottom", () => {
170
- const config = Yoga.Config.create()
171
- let root
172
-
173
- try {
174
- root = Yoga.Node.create(config)
175
- root.setJustifyContent(Justify.FlexEnd)
176
- root.setPositionType(PositionType.Absolute)
177
- root.setWidth(100)
178
- root.setHeight(100)
179
-
180
- const root_child0 = Yoga.Node.create(config)
181
- root_child0.setMargin(Edge.Bottom, 10)
182
- root_child0.setHeight(10)
183
- root.insertChild(root_child0, 0)
184
- root.calculateLayout(undefined, undefined, Direction.LTR)
185
-
186
- expect(root.getComputedLeft()).toBe(0)
187
- expect(root.getComputedTop()).toBe(0)
188
- expect(root.getComputedWidth()).toBe(100)
189
- expect(root.getComputedHeight()).toBe(100)
190
-
191
- expect(root_child0.getComputedLeft()).toBe(0)
192
- expect(root_child0.getComputedTop()).toBe(80)
193
- expect(root_child0.getComputedWidth()).toBe(100)
194
- expect(root_child0.getComputedHeight()).toBe(10)
195
-
196
- root.calculateLayout(undefined, undefined, Direction.RTL)
197
-
198
- expect(root.getComputedLeft()).toBe(0)
199
- expect(root.getComputedTop()).toBe(0)
200
- expect(root.getComputedWidth()).toBe(100)
201
- expect(root.getComputedHeight()).toBe(100)
202
-
203
- expect(root_child0.getComputedLeft()).toBe(0)
204
- expect(root_child0.getComputedTop()).toBe(80)
205
- expect(root_child0.getComputedWidth()).toBe(100)
206
- expect(root_child0.getComputedHeight()).toBe(10)
207
- } finally {
208
- if (typeof root !== "undefined") {
209
- root.freeRecursive()
210
- }
211
-
212
- config.free()
213
- }
214
- })
215
- test("margin_and_flex_row", () => {
216
- const config = Yoga.Config.create()
217
- let root
218
-
219
- try {
220
- root = Yoga.Node.create(config)
221
- root.setFlexDirection(FlexDirection.Row)
222
- root.setPositionType(PositionType.Absolute)
223
- root.setWidth(100)
224
- root.setHeight(100)
225
-
226
- const root_child0 = Yoga.Node.create(config)
227
- root_child0.setFlexGrow(1)
228
- root_child0.setMargin(Edge.Start, 10)
229
- root_child0.setMargin(Edge.End, 10)
230
- root.insertChild(root_child0, 0)
231
- root.calculateLayout(undefined, undefined, Direction.LTR)
232
-
233
- expect(root.getComputedLeft()).toBe(0)
234
- expect(root.getComputedTop()).toBe(0)
235
- expect(root.getComputedWidth()).toBe(100)
236
- expect(root.getComputedHeight()).toBe(100)
237
-
238
- expect(root_child0.getComputedLeft()).toBe(10)
239
- expect(root_child0.getComputedTop()).toBe(0)
240
- expect(root_child0.getComputedWidth()).toBe(80)
241
- expect(root_child0.getComputedHeight()).toBe(100)
242
-
243
- root.calculateLayout(undefined, undefined, Direction.RTL)
244
-
245
- expect(root.getComputedLeft()).toBe(0)
246
- expect(root.getComputedTop()).toBe(0)
247
- expect(root.getComputedWidth()).toBe(100)
248
- expect(root.getComputedHeight()).toBe(100)
249
-
250
- expect(root_child0.getComputedLeft()).toBe(10)
251
- expect(root_child0.getComputedTop()).toBe(0)
252
- expect(root_child0.getComputedWidth()).toBe(80)
253
- expect(root_child0.getComputedHeight()).toBe(100)
254
- } finally {
255
- if (typeof root !== "undefined") {
256
- root.freeRecursive()
257
- }
258
-
259
- config.free()
260
- }
261
- })
262
- test("margin_and_flex_column", () => {
263
- const config = Yoga.Config.create()
264
- let root
265
-
266
- try {
267
- root = Yoga.Node.create(config)
268
- root.setPositionType(PositionType.Absolute)
269
- root.setWidth(100)
270
- root.setHeight(100)
271
-
272
- const root_child0 = Yoga.Node.create(config)
273
- root_child0.setFlexGrow(1)
274
- root_child0.setMargin(Edge.Top, 10)
275
- root_child0.setMargin(Edge.Bottom, 10)
276
- root.insertChild(root_child0, 0)
277
- root.calculateLayout(undefined, undefined, Direction.LTR)
278
-
279
- expect(root.getComputedLeft()).toBe(0)
280
- expect(root.getComputedTop()).toBe(0)
281
- expect(root.getComputedWidth()).toBe(100)
282
- expect(root.getComputedHeight()).toBe(100)
283
-
284
- expect(root_child0.getComputedLeft()).toBe(0)
285
- expect(root_child0.getComputedTop()).toBe(10)
286
- expect(root_child0.getComputedWidth()).toBe(100)
287
- expect(root_child0.getComputedHeight()).toBe(80)
288
-
289
- root.calculateLayout(undefined, undefined, Direction.RTL)
290
-
291
- expect(root.getComputedLeft()).toBe(0)
292
- expect(root.getComputedTop()).toBe(0)
293
- expect(root.getComputedWidth()).toBe(100)
294
- expect(root.getComputedHeight()).toBe(100)
295
-
296
- expect(root_child0.getComputedLeft()).toBe(0)
297
- expect(root_child0.getComputedTop()).toBe(10)
298
- expect(root_child0.getComputedWidth()).toBe(100)
299
- expect(root_child0.getComputedHeight()).toBe(80)
300
- } finally {
301
- if (typeof root !== "undefined") {
302
- root.freeRecursive()
303
- }
304
-
305
- config.free()
306
- }
307
- })
308
- test("margin_and_stretch_row", () => {
309
- const config = Yoga.Config.create()
310
- let root
311
-
312
- try {
313
- root = Yoga.Node.create(config)
314
- root.setFlexDirection(FlexDirection.Row)
315
- root.setPositionType(PositionType.Absolute)
316
- root.setWidth(100)
317
- root.setHeight(100)
318
-
319
- const root_child0 = Yoga.Node.create(config)
320
- root_child0.setFlexGrow(1)
321
- root_child0.setMargin(Edge.Top, 10)
322
- root_child0.setMargin(Edge.Bottom, 10)
323
- root.insertChild(root_child0, 0)
324
- root.calculateLayout(undefined, undefined, Direction.LTR)
325
-
326
- expect(root.getComputedLeft()).toBe(0)
327
- expect(root.getComputedTop()).toBe(0)
328
- expect(root.getComputedWidth()).toBe(100)
329
- expect(root.getComputedHeight()).toBe(100)
330
-
331
- expect(root_child0.getComputedLeft()).toBe(0)
332
- expect(root_child0.getComputedTop()).toBe(10)
333
- expect(root_child0.getComputedWidth()).toBe(100)
334
- expect(root_child0.getComputedHeight()).toBe(80)
335
-
336
- root.calculateLayout(undefined, undefined, Direction.RTL)
337
-
338
- expect(root.getComputedLeft()).toBe(0)
339
- expect(root.getComputedTop()).toBe(0)
340
- expect(root.getComputedWidth()).toBe(100)
341
- expect(root.getComputedHeight()).toBe(100)
342
-
343
- expect(root_child0.getComputedLeft()).toBe(0)
344
- expect(root_child0.getComputedTop()).toBe(10)
345
- expect(root_child0.getComputedWidth()).toBe(100)
346
- expect(root_child0.getComputedHeight()).toBe(80)
347
- } finally {
348
- if (typeof root !== "undefined") {
349
- root.freeRecursive()
350
- }
351
-
352
- config.free()
353
- }
354
- })
355
- test("margin_and_stretch_column", () => {
356
- const config = Yoga.Config.create()
357
- let root
358
-
359
- try {
360
- root = Yoga.Node.create(config)
361
- root.setPositionType(PositionType.Absolute)
362
- root.setWidth(100)
363
- root.setHeight(100)
364
-
365
- const root_child0 = Yoga.Node.create(config)
366
- root_child0.setFlexGrow(1)
367
- root_child0.setMargin(Edge.Start, 10)
368
- root_child0.setMargin(Edge.End, 10)
369
- root.insertChild(root_child0, 0)
370
- root.calculateLayout(undefined, undefined, Direction.LTR)
371
-
372
- expect(root.getComputedLeft()).toBe(0)
373
- expect(root.getComputedTop()).toBe(0)
374
- expect(root.getComputedWidth()).toBe(100)
375
- expect(root.getComputedHeight()).toBe(100)
376
-
377
- expect(root_child0.getComputedLeft()).toBe(10)
378
- expect(root_child0.getComputedTop()).toBe(0)
379
- expect(root_child0.getComputedWidth()).toBe(80)
380
- expect(root_child0.getComputedHeight()).toBe(100)
381
-
382
- root.calculateLayout(undefined, undefined, Direction.RTL)
383
-
384
- expect(root.getComputedLeft()).toBe(0)
385
- expect(root.getComputedTop()).toBe(0)
386
- expect(root.getComputedWidth()).toBe(100)
387
- expect(root.getComputedHeight()).toBe(100)
388
-
389
- expect(root_child0.getComputedLeft()).toBe(10)
390
- expect(root_child0.getComputedTop()).toBe(0)
391
- expect(root_child0.getComputedWidth()).toBe(80)
392
- expect(root_child0.getComputedHeight()).toBe(100)
393
- } finally {
394
- if (typeof root !== "undefined") {
395
- root.freeRecursive()
396
- }
397
-
398
- config.free()
399
- }
400
- })
401
- test("margin_with_sibling_row", () => {
402
- const config = Yoga.Config.create()
403
- let root
404
-
405
- try {
406
- root = Yoga.Node.create(config)
407
- root.setFlexDirection(FlexDirection.Row)
408
- root.setPositionType(PositionType.Absolute)
409
- root.setWidth(100)
410
- root.setHeight(100)
411
-
412
- const root_child0 = Yoga.Node.create(config)
413
- root_child0.setFlexGrow(1)
414
- root_child0.setMargin(Edge.End, 10)
415
- root.insertChild(root_child0, 0)
416
-
417
- const root_child1 = Yoga.Node.create(config)
418
- root_child1.setFlexGrow(1)
419
- root.insertChild(root_child1, 1)
420
- root.calculateLayout(undefined, undefined, Direction.LTR)
421
-
422
- expect(root.getComputedLeft()).toBe(0)
423
- expect(root.getComputedTop()).toBe(0)
424
- expect(root.getComputedWidth()).toBe(100)
425
- expect(root.getComputedHeight()).toBe(100)
426
-
427
- expect(root_child0.getComputedLeft()).toBe(0)
428
- expect(root_child0.getComputedTop()).toBe(0)
429
- expect(root_child0.getComputedWidth()).toBe(45)
430
- expect(root_child0.getComputedHeight()).toBe(100)
431
-
432
- expect(root_child1.getComputedLeft()).toBe(55)
433
- expect(root_child1.getComputedTop()).toBe(0)
434
- expect(root_child1.getComputedWidth()).toBe(45)
435
- expect(root_child1.getComputedHeight()).toBe(100)
436
-
437
- root.calculateLayout(undefined, undefined, Direction.RTL)
438
-
439
- expect(root.getComputedLeft()).toBe(0)
440
- expect(root.getComputedTop()).toBe(0)
441
- expect(root.getComputedWidth()).toBe(100)
442
- expect(root.getComputedHeight()).toBe(100)
443
-
444
- expect(root_child0.getComputedLeft()).toBe(55)
445
- expect(root_child0.getComputedTop()).toBe(0)
446
- expect(root_child0.getComputedWidth()).toBe(45)
447
- expect(root_child0.getComputedHeight()).toBe(100)
448
-
449
- expect(root_child1.getComputedLeft()).toBe(0)
450
- expect(root_child1.getComputedTop()).toBe(0)
451
- expect(root_child1.getComputedWidth()).toBe(45)
452
- expect(root_child1.getComputedHeight()).toBe(100)
453
- } finally {
454
- if (typeof root !== "undefined") {
455
- root.freeRecursive()
456
- }
457
-
458
- config.free()
459
- }
460
- })
461
- test("margin_with_sibling_column", () => {
462
- const config = Yoga.Config.create()
463
- let root
464
-
465
- try {
466
- root = Yoga.Node.create(config)
467
- root.setPositionType(PositionType.Absolute)
468
- root.setWidth(100)
469
- root.setHeight(100)
470
-
471
- const root_child0 = Yoga.Node.create(config)
472
- root_child0.setFlexGrow(1)
473
- root_child0.setMargin(Edge.Bottom, 10)
474
- root.insertChild(root_child0, 0)
475
-
476
- const root_child1 = Yoga.Node.create(config)
477
- root_child1.setFlexGrow(1)
478
- root.insertChild(root_child1, 1)
479
- root.calculateLayout(undefined, undefined, Direction.LTR)
480
-
481
- expect(root.getComputedLeft()).toBe(0)
482
- expect(root.getComputedTop()).toBe(0)
483
- expect(root.getComputedWidth()).toBe(100)
484
- expect(root.getComputedHeight()).toBe(100)
485
-
486
- expect(root_child0.getComputedLeft()).toBe(0)
487
- expect(root_child0.getComputedTop()).toBe(0)
488
- expect(root_child0.getComputedWidth()).toBe(100)
489
- expect(root_child0.getComputedHeight()).toBe(45)
490
-
491
- expect(root_child1.getComputedLeft()).toBe(0)
492
- expect(root_child1.getComputedTop()).toBe(55)
493
- expect(root_child1.getComputedWidth()).toBe(100)
494
- expect(root_child1.getComputedHeight()).toBe(45)
495
-
496
- root.calculateLayout(undefined, undefined, Direction.RTL)
497
-
498
- expect(root.getComputedLeft()).toBe(0)
499
- expect(root.getComputedTop()).toBe(0)
500
- expect(root.getComputedWidth()).toBe(100)
501
- expect(root.getComputedHeight()).toBe(100)
502
-
503
- expect(root_child0.getComputedLeft()).toBe(0)
504
- expect(root_child0.getComputedTop()).toBe(0)
505
- expect(root_child0.getComputedWidth()).toBe(100)
506
- expect(root_child0.getComputedHeight()).toBe(45)
507
-
508
- expect(root_child1.getComputedLeft()).toBe(0)
509
- expect(root_child1.getComputedTop()).toBe(55)
510
- expect(root_child1.getComputedWidth()).toBe(100)
511
- expect(root_child1.getComputedHeight()).toBe(45)
512
- } finally {
513
- if (typeof root !== "undefined") {
514
- root.freeRecursive()
515
- }
516
-
517
- config.free()
518
- }
519
- })
520
- test("margin_auto_bottom", () => {
521
- const config = Yoga.Config.create()
522
- let root
523
-
524
- try {
525
- root = Yoga.Node.create(config)
526
- root.setAlignItems(Align.Center)
527
- root.setPositionType(PositionType.Absolute)
528
- root.setWidth(200)
529
- root.setHeight(200)
530
-
531
- const root_child0 = Yoga.Node.create(config)
532
- root_child0.setMargin(Edge.Bottom, "auto")
533
- root_child0.setWidth(50)
534
- root_child0.setHeight(50)
535
- root.insertChild(root_child0, 0)
536
-
537
- const root_child1 = Yoga.Node.create(config)
538
- root_child1.setWidth(50)
539
- root_child1.setHeight(50)
540
- root.insertChild(root_child1, 1)
541
- root.calculateLayout(undefined, undefined, Direction.LTR)
542
-
543
- expect(root.getComputedLeft()).toBe(0)
544
- expect(root.getComputedTop()).toBe(0)
545
- expect(root.getComputedWidth()).toBe(200)
546
- expect(root.getComputedHeight()).toBe(200)
547
-
548
- expect(root_child0.getComputedLeft()).toBe(75)
549
- expect(root_child0.getComputedTop()).toBe(0)
550
- expect(root_child0.getComputedWidth()).toBe(50)
551
- expect(root_child0.getComputedHeight()).toBe(50)
552
-
553
- expect(root_child1.getComputedLeft()).toBe(75)
554
- expect(root_child1.getComputedTop()).toBe(150)
555
- expect(root_child1.getComputedWidth()).toBe(50)
556
- expect(root_child1.getComputedHeight()).toBe(50)
557
-
558
- root.calculateLayout(undefined, undefined, Direction.RTL)
559
-
560
- expect(root.getComputedLeft()).toBe(0)
561
- expect(root.getComputedTop()).toBe(0)
562
- expect(root.getComputedWidth()).toBe(200)
563
- expect(root.getComputedHeight()).toBe(200)
564
-
565
- expect(root_child0.getComputedLeft()).toBe(75)
566
- expect(root_child0.getComputedTop()).toBe(0)
567
- expect(root_child0.getComputedWidth()).toBe(50)
568
- expect(root_child0.getComputedHeight()).toBe(50)
569
-
570
- expect(root_child1.getComputedLeft()).toBe(75)
571
- expect(root_child1.getComputedTop()).toBe(150)
572
- expect(root_child1.getComputedWidth()).toBe(50)
573
- expect(root_child1.getComputedHeight()).toBe(50)
574
- } finally {
575
- if (typeof root !== "undefined") {
576
- root.freeRecursive()
577
- }
578
-
579
- config.free()
580
- }
581
- })
582
- test("margin_auto_top", () => {
583
- const config = Yoga.Config.create()
584
- let root
585
-
586
- try {
587
- root = Yoga.Node.create(config)
588
- root.setAlignItems(Align.Center)
589
- root.setPositionType(PositionType.Absolute)
590
- root.setWidth(200)
591
- root.setHeight(200)
592
-
593
- const root_child0 = Yoga.Node.create(config)
594
- root_child0.setMargin(Edge.Top, "auto")
595
- root_child0.setWidth(50)
596
- root_child0.setHeight(50)
597
- root.insertChild(root_child0, 0)
598
-
599
- const root_child1 = Yoga.Node.create(config)
600
- root_child1.setWidth(50)
601
- root_child1.setHeight(50)
602
- root.insertChild(root_child1, 1)
603
- root.calculateLayout(undefined, undefined, Direction.LTR)
604
-
605
- expect(root.getComputedLeft()).toBe(0)
606
- expect(root.getComputedTop()).toBe(0)
607
- expect(root.getComputedWidth()).toBe(200)
608
- expect(root.getComputedHeight()).toBe(200)
609
-
610
- expect(root_child0.getComputedLeft()).toBe(75)
611
- expect(root_child0.getComputedTop()).toBe(100)
612
- expect(root_child0.getComputedWidth()).toBe(50)
613
- expect(root_child0.getComputedHeight()).toBe(50)
614
-
615
- expect(root_child1.getComputedLeft()).toBe(75)
616
- expect(root_child1.getComputedTop()).toBe(150)
617
- expect(root_child1.getComputedWidth()).toBe(50)
618
- expect(root_child1.getComputedHeight()).toBe(50)
619
-
620
- root.calculateLayout(undefined, undefined, Direction.RTL)
621
-
622
- expect(root.getComputedLeft()).toBe(0)
623
- expect(root.getComputedTop()).toBe(0)
624
- expect(root.getComputedWidth()).toBe(200)
625
- expect(root.getComputedHeight()).toBe(200)
626
-
627
- expect(root_child0.getComputedLeft()).toBe(75)
628
- expect(root_child0.getComputedTop()).toBe(100)
629
- expect(root_child0.getComputedWidth()).toBe(50)
630
- expect(root_child0.getComputedHeight()).toBe(50)
631
-
632
- expect(root_child1.getComputedLeft()).toBe(75)
633
- expect(root_child1.getComputedTop()).toBe(150)
634
- expect(root_child1.getComputedWidth()).toBe(50)
635
- expect(root_child1.getComputedHeight()).toBe(50)
636
- } finally {
637
- if (typeof root !== "undefined") {
638
- root.freeRecursive()
639
- }
640
-
641
- config.free()
642
- }
643
- })
644
- test("margin_auto_bottom_and_top", () => {
645
- const config = Yoga.Config.create()
646
- let root
647
-
648
- try {
649
- root = Yoga.Node.create(config)
650
- root.setAlignItems(Align.Center)
651
- root.setPositionType(PositionType.Absolute)
652
- root.setWidth(200)
653
- root.setHeight(200)
654
-
655
- const root_child0 = Yoga.Node.create(config)
656
- root_child0.setMargin(Edge.Top, "auto")
657
- root_child0.setMargin(Edge.Bottom, "auto")
658
- root_child0.setWidth(50)
659
- root_child0.setHeight(50)
660
- root.insertChild(root_child0, 0)
661
-
662
- const root_child1 = Yoga.Node.create(config)
663
- root_child1.setWidth(50)
664
- root_child1.setHeight(50)
665
- root.insertChild(root_child1, 1)
666
- root.calculateLayout(undefined, undefined, Direction.LTR)
667
-
668
- expect(root.getComputedLeft()).toBe(0)
669
- expect(root.getComputedTop()).toBe(0)
670
- expect(root.getComputedWidth()).toBe(200)
671
- expect(root.getComputedHeight()).toBe(200)
672
-
673
- expect(root_child0.getComputedLeft()).toBe(75)
674
- expect(root_child0.getComputedTop()).toBe(50)
675
- expect(root_child0.getComputedWidth()).toBe(50)
676
- expect(root_child0.getComputedHeight()).toBe(50)
677
-
678
- expect(root_child1.getComputedLeft()).toBe(75)
679
- expect(root_child1.getComputedTop()).toBe(150)
680
- expect(root_child1.getComputedWidth()).toBe(50)
681
- expect(root_child1.getComputedHeight()).toBe(50)
682
-
683
- root.calculateLayout(undefined, undefined, Direction.RTL)
684
-
685
- expect(root.getComputedLeft()).toBe(0)
686
- expect(root.getComputedTop()).toBe(0)
687
- expect(root.getComputedWidth()).toBe(200)
688
- expect(root.getComputedHeight()).toBe(200)
689
-
690
- expect(root_child0.getComputedLeft()).toBe(75)
691
- expect(root_child0.getComputedTop()).toBe(50)
692
- expect(root_child0.getComputedWidth()).toBe(50)
693
- expect(root_child0.getComputedHeight()).toBe(50)
694
-
695
- expect(root_child1.getComputedLeft()).toBe(75)
696
- expect(root_child1.getComputedTop()).toBe(150)
697
- expect(root_child1.getComputedWidth()).toBe(50)
698
- expect(root_child1.getComputedHeight()).toBe(50)
699
- } finally {
700
- if (typeof root !== "undefined") {
701
- root.freeRecursive()
702
- }
703
-
704
- config.free()
705
- }
706
- })
707
- test("margin_auto_bottom_and_top_justify_center", () => {
708
- const config = Yoga.Config.create()
709
- let root
710
-
711
- try {
712
- root = Yoga.Node.create(config)
713
- root.setJustifyContent(Justify.Center)
714
- root.setPositionType(PositionType.Absolute)
715
- root.setWidth(200)
716
- root.setHeight(200)
717
-
718
- const root_child0 = Yoga.Node.create(config)
719
- root_child0.setMargin(Edge.Top, "auto")
720
- root_child0.setMargin(Edge.Bottom, "auto")
721
- root_child0.setWidth(50)
722
- root_child0.setHeight(50)
723
- root.insertChild(root_child0, 0)
724
-
725
- const root_child1 = Yoga.Node.create(config)
726
- root_child1.setWidth(50)
727
- root_child1.setHeight(50)
728
- root.insertChild(root_child1, 1)
729
- root.calculateLayout(undefined, undefined, Direction.LTR)
730
-
731
- expect(root.getComputedLeft()).toBe(0)
732
- expect(root.getComputedTop()).toBe(0)
733
- expect(root.getComputedWidth()).toBe(200)
734
- expect(root.getComputedHeight()).toBe(200)
735
-
736
- expect(root_child0.getComputedLeft()).toBe(0)
737
- expect(root_child0.getComputedTop()).toBe(50)
738
- expect(root_child0.getComputedWidth()).toBe(50)
739
- expect(root_child0.getComputedHeight()).toBe(50)
740
-
741
- expect(root_child1.getComputedLeft()).toBe(0)
742
- expect(root_child1.getComputedTop()).toBe(150)
743
- expect(root_child1.getComputedWidth()).toBe(50)
744
- expect(root_child1.getComputedHeight()).toBe(50)
745
-
746
- root.calculateLayout(undefined, undefined, Direction.RTL)
747
-
748
- expect(root.getComputedLeft()).toBe(0)
749
- expect(root.getComputedTop()).toBe(0)
750
- expect(root.getComputedWidth()).toBe(200)
751
- expect(root.getComputedHeight()).toBe(200)
752
-
753
- expect(root_child0.getComputedLeft()).toBe(150)
754
- expect(root_child0.getComputedTop()).toBe(50)
755
- expect(root_child0.getComputedWidth()).toBe(50)
756
- expect(root_child0.getComputedHeight()).toBe(50)
757
-
758
- expect(root_child1.getComputedLeft()).toBe(150)
759
- expect(root_child1.getComputedTop()).toBe(150)
760
- expect(root_child1.getComputedWidth()).toBe(50)
761
- expect(root_child1.getComputedHeight()).toBe(50)
762
- } finally {
763
- if (typeof root !== "undefined") {
764
- root.freeRecursive()
765
- }
766
-
767
- config.free()
768
- }
769
- })
770
- test("margin_auto_multiple_children_column", () => {
771
- const config = Yoga.Config.create()
772
- let root
773
-
774
- try {
775
- root = Yoga.Node.create(config)
776
- root.setAlignItems(Align.Center)
777
- root.setPositionType(PositionType.Absolute)
778
- root.setWidth(200)
779
- root.setHeight(200)
780
-
781
- const root_child0 = Yoga.Node.create(config)
782
- root_child0.setMargin(Edge.Top, "auto")
783
- root_child0.setWidth(50)
784
- root_child0.setHeight(50)
785
- root.insertChild(root_child0, 0)
786
-
787
- const root_child1 = Yoga.Node.create(config)
788
- root_child1.setMargin(Edge.Top, "auto")
789
- root_child1.setWidth(50)
790
- root_child1.setHeight(50)
791
- root.insertChild(root_child1, 1)
792
-
793
- const root_child2 = Yoga.Node.create(config)
794
- root_child2.setWidth(50)
795
- root_child2.setHeight(50)
796
- root.insertChild(root_child2, 2)
797
- root.calculateLayout(undefined, undefined, Direction.LTR)
798
-
799
- expect(root.getComputedLeft()).toBe(0)
800
- expect(root.getComputedTop()).toBe(0)
801
- expect(root.getComputedWidth()).toBe(200)
802
- expect(root.getComputedHeight()).toBe(200)
803
-
804
- expect(root_child0.getComputedLeft()).toBe(75)
805
- expect(root_child0.getComputedTop()).toBe(25)
806
- expect(root_child0.getComputedWidth()).toBe(50)
807
- expect(root_child0.getComputedHeight()).toBe(50)
808
-
809
- expect(root_child1.getComputedLeft()).toBe(75)
810
- expect(root_child1.getComputedTop()).toBe(100)
811
- expect(root_child1.getComputedWidth()).toBe(50)
812
- expect(root_child1.getComputedHeight()).toBe(50)
813
-
814
- expect(root_child2.getComputedLeft()).toBe(75)
815
- expect(root_child2.getComputedTop()).toBe(150)
816
- expect(root_child2.getComputedWidth()).toBe(50)
817
- expect(root_child2.getComputedHeight()).toBe(50)
818
-
819
- root.calculateLayout(undefined, undefined, Direction.RTL)
820
-
821
- expect(root.getComputedLeft()).toBe(0)
822
- expect(root.getComputedTop()).toBe(0)
823
- expect(root.getComputedWidth()).toBe(200)
824
- expect(root.getComputedHeight()).toBe(200)
825
-
826
- expect(root_child0.getComputedLeft()).toBe(75)
827
- expect(root_child0.getComputedTop()).toBe(25)
828
- expect(root_child0.getComputedWidth()).toBe(50)
829
- expect(root_child0.getComputedHeight()).toBe(50)
830
-
831
- expect(root_child1.getComputedLeft()).toBe(75)
832
- expect(root_child1.getComputedTop()).toBe(100)
833
- expect(root_child1.getComputedWidth()).toBe(50)
834
- expect(root_child1.getComputedHeight()).toBe(50)
835
-
836
- expect(root_child2.getComputedLeft()).toBe(75)
837
- expect(root_child2.getComputedTop()).toBe(150)
838
- expect(root_child2.getComputedWidth()).toBe(50)
839
- expect(root_child2.getComputedHeight()).toBe(50)
840
- } finally {
841
- if (typeof root !== "undefined") {
842
- root.freeRecursive()
843
- }
844
-
845
- config.free()
846
- }
847
- })
848
- test("margin_auto_multiple_children_row", () => {
849
- const config = Yoga.Config.create()
850
- let root
851
-
852
- try {
853
- root = Yoga.Node.create(config)
854
- root.setFlexDirection(FlexDirection.Row)
855
- root.setAlignItems(Align.Center)
856
- root.setPositionType(PositionType.Absolute)
857
- root.setWidth(200)
858
- root.setHeight(200)
859
-
860
- const root_child0 = Yoga.Node.create(config)
861
- root_child0.setMargin(Edge.Right, "auto")
862
- root_child0.setWidth(50)
863
- root_child0.setHeight(50)
864
- root.insertChild(root_child0, 0)
865
-
866
- const root_child1 = Yoga.Node.create(config)
867
- root_child1.setMargin(Edge.Right, "auto")
868
- root_child1.setWidth(50)
869
- root_child1.setHeight(50)
870
- root.insertChild(root_child1, 1)
871
-
872
- const root_child2 = Yoga.Node.create(config)
873
- root_child2.setWidth(50)
874
- root_child2.setHeight(50)
875
- root.insertChild(root_child2, 2)
876
- root.calculateLayout(undefined, undefined, Direction.LTR)
877
-
878
- expect(root.getComputedLeft()).toBe(0)
879
- expect(root.getComputedTop()).toBe(0)
880
- expect(root.getComputedWidth()).toBe(200)
881
- expect(root.getComputedHeight()).toBe(200)
882
-
883
- expect(root_child0.getComputedLeft()).toBe(0)
884
- expect(root_child0.getComputedTop()).toBe(75)
885
- expect(root_child0.getComputedWidth()).toBe(50)
886
- expect(root_child0.getComputedHeight()).toBe(50)
887
-
888
- expect(root_child1.getComputedLeft()).toBe(75)
889
- expect(root_child1.getComputedTop()).toBe(75)
890
- expect(root_child1.getComputedWidth()).toBe(50)
891
- expect(root_child1.getComputedHeight()).toBe(50)
892
-
893
- expect(root_child2.getComputedLeft()).toBe(150)
894
- expect(root_child2.getComputedTop()).toBe(75)
895
- expect(root_child2.getComputedWidth()).toBe(50)
896
- expect(root_child2.getComputedHeight()).toBe(50)
897
-
898
- root.calculateLayout(undefined, undefined, Direction.RTL)
899
-
900
- expect(root.getComputedLeft()).toBe(0)
901
- expect(root.getComputedTop()).toBe(0)
902
- expect(root.getComputedWidth()).toBe(200)
903
- expect(root.getComputedHeight()).toBe(200)
904
-
905
- expect(root_child0.getComputedLeft()).toBe(125)
906
- expect(root_child0.getComputedTop()).toBe(75)
907
- expect(root_child0.getComputedWidth()).toBe(50)
908
- expect(root_child0.getComputedHeight()).toBe(50)
909
-
910
- expect(root_child1.getComputedLeft()).toBe(50)
911
- expect(root_child1.getComputedTop()).toBe(75)
912
- expect(root_child1.getComputedWidth()).toBe(50)
913
- expect(root_child1.getComputedHeight()).toBe(50)
914
-
915
- expect(root_child2.getComputedLeft()).toBe(0)
916
- expect(root_child2.getComputedTop()).toBe(75)
917
- expect(root_child2.getComputedWidth()).toBe(50)
918
- expect(root_child2.getComputedHeight()).toBe(50)
919
- } finally {
920
- if (typeof root !== "undefined") {
921
- root.freeRecursive()
922
- }
923
-
924
- config.free()
925
- }
926
- })
927
- test("margin_auto_left_and_right_column", () => {
928
- const config = Yoga.Config.create()
929
- let root
930
-
931
- try {
932
- root = Yoga.Node.create(config)
933
- root.setFlexDirection(FlexDirection.Row)
934
- root.setAlignItems(Align.Center)
935
- root.setPositionType(PositionType.Absolute)
936
- root.setWidth(200)
937
- root.setHeight(200)
938
-
939
- const root_child0 = Yoga.Node.create(config)
940
- root_child0.setMargin(Edge.Left, "auto")
941
- root_child0.setMargin(Edge.Right, "auto")
942
- root_child0.setWidth(50)
943
- root_child0.setHeight(50)
944
- root.insertChild(root_child0, 0)
945
-
946
- const root_child1 = Yoga.Node.create(config)
947
- root_child1.setWidth(50)
948
- root_child1.setHeight(50)
949
- root.insertChild(root_child1, 1)
950
- root.calculateLayout(undefined, undefined, Direction.LTR)
951
-
952
- expect(root.getComputedLeft()).toBe(0)
953
- expect(root.getComputedTop()).toBe(0)
954
- expect(root.getComputedWidth()).toBe(200)
955
- expect(root.getComputedHeight()).toBe(200)
956
-
957
- expect(root_child0.getComputedLeft()).toBe(50)
958
- expect(root_child0.getComputedTop()).toBe(75)
959
- expect(root_child0.getComputedWidth()).toBe(50)
960
- expect(root_child0.getComputedHeight()).toBe(50)
961
-
962
- expect(root_child1.getComputedLeft()).toBe(150)
963
- expect(root_child1.getComputedTop()).toBe(75)
964
- expect(root_child1.getComputedWidth()).toBe(50)
965
- expect(root_child1.getComputedHeight()).toBe(50)
966
-
967
- root.calculateLayout(undefined, undefined, Direction.RTL)
968
-
969
- expect(root.getComputedLeft()).toBe(0)
970
- expect(root.getComputedTop()).toBe(0)
971
- expect(root.getComputedWidth()).toBe(200)
972
- expect(root.getComputedHeight()).toBe(200)
973
-
974
- expect(root_child0.getComputedLeft()).toBe(100)
975
- expect(root_child0.getComputedTop()).toBe(75)
976
- expect(root_child0.getComputedWidth()).toBe(50)
977
- expect(root_child0.getComputedHeight()).toBe(50)
978
-
979
- expect(root_child1.getComputedLeft()).toBe(0)
980
- expect(root_child1.getComputedTop()).toBe(75)
981
- expect(root_child1.getComputedWidth()).toBe(50)
982
- expect(root_child1.getComputedHeight()).toBe(50)
983
- } finally {
984
- if (typeof root !== "undefined") {
985
- root.freeRecursive()
986
- }
987
-
988
- config.free()
989
- }
990
- })
991
- test("margin_auto_left_and_right", () => {
992
- const config = Yoga.Config.create()
993
- let root
994
-
995
- try {
996
- root = Yoga.Node.create(config)
997
- root.setPositionType(PositionType.Absolute)
998
- root.setWidth(200)
999
- root.setHeight(200)
1000
-
1001
- const root_child0 = Yoga.Node.create(config)
1002
- root_child0.setMargin(Edge.Left, "auto")
1003
- root_child0.setMargin(Edge.Right, "auto")
1004
- root_child0.setWidth(50)
1005
- root_child0.setHeight(50)
1006
- root.insertChild(root_child0, 0)
1007
-
1008
- const root_child1 = Yoga.Node.create(config)
1009
- root_child1.setWidth(50)
1010
- root_child1.setHeight(50)
1011
- root.insertChild(root_child1, 1)
1012
- root.calculateLayout(undefined, undefined, Direction.LTR)
1013
-
1014
- expect(root.getComputedLeft()).toBe(0)
1015
- expect(root.getComputedTop()).toBe(0)
1016
- expect(root.getComputedWidth()).toBe(200)
1017
- expect(root.getComputedHeight()).toBe(200)
1018
-
1019
- expect(root_child0.getComputedLeft()).toBe(75)
1020
- expect(root_child0.getComputedTop()).toBe(0)
1021
- expect(root_child0.getComputedWidth()).toBe(50)
1022
- expect(root_child0.getComputedHeight()).toBe(50)
1023
-
1024
- expect(root_child1.getComputedLeft()).toBe(0)
1025
- expect(root_child1.getComputedTop()).toBe(50)
1026
- expect(root_child1.getComputedWidth()).toBe(50)
1027
- expect(root_child1.getComputedHeight()).toBe(50)
1028
-
1029
- root.calculateLayout(undefined, undefined, Direction.RTL)
1030
-
1031
- expect(root.getComputedLeft()).toBe(0)
1032
- expect(root.getComputedTop()).toBe(0)
1033
- expect(root.getComputedWidth()).toBe(200)
1034
- expect(root.getComputedHeight()).toBe(200)
1035
-
1036
- expect(root_child0.getComputedLeft()).toBe(75)
1037
- expect(root_child0.getComputedTop()).toBe(0)
1038
- expect(root_child0.getComputedWidth()).toBe(50)
1039
- expect(root_child0.getComputedHeight()).toBe(50)
1040
-
1041
- expect(root_child1.getComputedLeft()).toBe(150)
1042
- expect(root_child1.getComputedTop()).toBe(50)
1043
- expect(root_child1.getComputedWidth()).toBe(50)
1044
- expect(root_child1.getComputedHeight()).toBe(50)
1045
- } finally {
1046
- if (typeof root !== "undefined") {
1047
- root.freeRecursive()
1048
- }
1049
-
1050
- config.free()
1051
- }
1052
- })
1053
- test("margin_auto_start_and_end_column", () => {
1054
- const config = Yoga.Config.create()
1055
- let root
1056
-
1057
- try {
1058
- root = Yoga.Node.create(config)
1059
- root.setFlexDirection(FlexDirection.Row)
1060
- root.setAlignItems(Align.Center)
1061
- root.setPositionType(PositionType.Absolute)
1062
- root.setWidth(200)
1063
- root.setHeight(200)
1064
-
1065
- const root_child0 = Yoga.Node.create(config)
1066
- root_child0.setMargin(Edge.Start, "auto")
1067
- root_child0.setMargin(Edge.End, "auto")
1068
- root_child0.setWidth(50)
1069
- root_child0.setHeight(50)
1070
- root.insertChild(root_child0, 0)
1071
-
1072
- const root_child1 = Yoga.Node.create(config)
1073
- root_child1.setWidth(50)
1074
- root_child1.setHeight(50)
1075
- root.insertChild(root_child1, 1)
1076
- root.calculateLayout(undefined, undefined, Direction.LTR)
1077
-
1078
- expect(root.getComputedLeft()).toBe(0)
1079
- expect(root.getComputedTop()).toBe(0)
1080
- expect(root.getComputedWidth()).toBe(200)
1081
- expect(root.getComputedHeight()).toBe(200)
1082
-
1083
- expect(root_child0.getComputedLeft()).toBe(50)
1084
- expect(root_child0.getComputedTop()).toBe(75)
1085
- expect(root_child0.getComputedWidth()).toBe(50)
1086
- expect(root_child0.getComputedHeight()).toBe(50)
1087
-
1088
- expect(root_child1.getComputedLeft()).toBe(150)
1089
- expect(root_child1.getComputedTop()).toBe(75)
1090
- expect(root_child1.getComputedWidth()).toBe(50)
1091
- expect(root_child1.getComputedHeight()).toBe(50)
1092
-
1093
- root.calculateLayout(undefined, undefined, Direction.RTL)
1094
-
1095
- expect(root.getComputedLeft()).toBe(0)
1096
- expect(root.getComputedTop()).toBe(0)
1097
- expect(root.getComputedWidth()).toBe(200)
1098
- expect(root.getComputedHeight()).toBe(200)
1099
-
1100
- expect(root_child0.getComputedLeft()).toBe(100)
1101
- expect(root_child0.getComputedTop()).toBe(75)
1102
- expect(root_child0.getComputedWidth()).toBe(50)
1103
- expect(root_child0.getComputedHeight()).toBe(50)
1104
-
1105
- expect(root_child1.getComputedLeft()).toBe(0)
1106
- expect(root_child1.getComputedTop()).toBe(75)
1107
- expect(root_child1.getComputedWidth()).toBe(50)
1108
- expect(root_child1.getComputedHeight()).toBe(50)
1109
- } finally {
1110
- if (typeof root !== "undefined") {
1111
- root.freeRecursive()
1112
- }
1113
-
1114
- config.free()
1115
- }
1116
- })
1117
- test("margin_auto_start_and_end", () => {
1118
- const config = Yoga.Config.create()
1119
- let root
1120
-
1121
- try {
1122
- root = Yoga.Node.create(config)
1123
- root.setPositionType(PositionType.Absolute)
1124
- root.setWidth(200)
1125
- root.setHeight(200)
1126
-
1127
- const root_child0 = Yoga.Node.create(config)
1128
- root_child0.setMargin(Edge.Start, "auto")
1129
- root_child0.setMargin(Edge.End, "auto")
1130
- root_child0.setWidth(50)
1131
- root_child0.setHeight(50)
1132
- root.insertChild(root_child0, 0)
1133
-
1134
- const root_child1 = Yoga.Node.create(config)
1135
- root_child1.setWidth(50)
1136
- root_child1.setHeight(50)
1137
- root.insertChild(root_child1, 1)
1138
- root.calculateLayout(undefined, undefined, Direction.LTR)
1139
-
1140
- expect(root.getComputedLeft()).toBe(0)
1141
- expect(root.getComputedTop()).toBe(0)
1142
- expect(root.getComputedWidth()).toBe(200)
1143
- expect(root.getComputedHeight()).toBe(200)
1144
-
1145
- expect(root_child0.getComputedLeft()).toBe(75)
1146
- expect(root_child0.getComputedTop()).toBe(0)
1147
- expect(root_child0.getComputedWidth()).toBe(50)
1148
- expect(root_child0.getComputedHeight()).toBe(50)
1149
-
1150
- expect(root_child1.getComputedLeft()).toBe(0)
1151
- expect(root_child1.getComputedTop()).toBe(50)
1152
- expect(root_child1.getComputedWidth()).toBe(50)
1153
- expect(root_child1.getComputedHeight()).toBe(50)
1154
-
1155
- root.calculateLayout(undefined, undefined, Direction.RTL)
1156
-
1157
- expect(root.getComputedLeft()).toBe(0)
1158
- expect(root.getComputedTop()).toBe(0)
1159
- expect(root.getComputedWidth()).toBe(200)
1160
- expect(root.getComputedHeight()).toBe(200)
1161
-
1162
- expect(root_child0.getComputedLeft()).toBe(75)
1163
- expect(root_child0.getComputedTop()).toBe(0)
1164
- expect(root_child0.getComputedWidth()).toBe(50)
1165
- expect(root_child0.getComputedHeight()).toBe(50)
1166
-
1167
- expect(root_child1.getComputedLeft()).toBe(150)
1168
- expect(root_child1.getComputedTop()).toBe(50)
1169
- expect(root_child1.getComputedWidth()).toBe(50)
1170
- expect(root_child1.getComputedHeight()).toBe(50)
1171
- } finally {
1172
- if (typeof root !== "undefined") {
1173
- root.freeRecursive()
1174
- }
1175
-
1176
- config.free()
1177
- }
1178
- })
1179
- test("margin_auto_left_and_right_column_and_center", () => {
1180
- const config = Yoga.Config.create()
1181
- let root
1182
-
1183
- try {
1184
- root = Yoga.Node.create(config)
1185
- root.setAlignItems(Align.Center)
1186
- root.setPositionType(PositionType.Absolute)
1187
- root.setWidth(200)
1188
- root.setHeight(200)
1189
-
1190
- const root_child0 = Yoga.Node.create(config)
1191
- root_child0.setMargin(Edge.Left, "auto")
1192
- root_child0.setMargin(Edge.Right, "auto")
1193
- root_child0.setWidth(50)
1194
- root_child0.setHeight(50)
1195
- root.insertChild(root_child0, 0)
1196
-
1197
- const root_child1 = Yoga.Node.create(config)
1198
- root_child1.setWidth(50)
1199
- root_child1.setHeight(50)
1200
- root.insertChild(root_child1, 1)
1201
- root.calculateLayout(undefined, undefined, Direction.LTR)
1202
-
1203
- expect(root.getComputedLeft()).toBe(0)
1204
- expect(root.getComputedTop()).toBe(0)
1205
- expect(root.getComputedWidth()).toBe(200)
1206
- expect(root.getComputedHeight()).toBe(200)
1207
-
1208
- expect(root_child0.getComputedLeft()).toBe(75)
1209
- expect(root_child0.getComputedTop()).toBe(0)
1210
- expect(root_child0.getComputedWidth()).toBe(50)
1211
- expect(root_child0.getComputedHeight()).toBe(50)
1212
-
1213
- expect(root_child1.getComputedLeft()).toBe(75)
1214
- expect(root_child1.getComputedTop()).toBe(50)
1215
- expect(root_child1.getComputedWidth()).toBe(50)
1216
- expect(root_child1.getComputedHeight()).toBe(50)
1217
-
1218
- root.calculateLayout(undefined, undefined, Direction.RTL)
1219
-
1220
- expect(root.getComputedLeft()).toBe(0)
1221
- expect(root.getComputedTop()).toBe(0)
1222
- expect(root.getComputedWidth()).toBe(200)
1223
- expect(root.getComputedHeight()).toBe(200)
1224
-
1225
- expect(root_child0.getComputedLeft()).toBe(75)
1226
- expect(root_child0.getComputedTop()).toBe(0)
1227
- expect(root_child0.getComputedWidth()).toBe(50)
1228
- expect(root_child0.getComputedHeight()).toBe(50)
1229
-
1230
- expect(root_child1.getComputedLeft()).toBe(75)
1231
- expect(root_child1.getComputedTop()).toBe(50)
1232
- expect(root_child1.getComputedWidth()).toBe(50)
1233
- expect(root_child1.getComputedHeight()).toBe(50)
1234
- } finally {
1235
- if (typeof root !== "undefined") {
1236
- root.freeRecursive()
1237
- }
1238
-
1239
- config.free()
1240
- }
1241
- })
1242
- test("margin_auto_left", () => {
1243
- const config = Yoga.Config.create()
1244
- let root
1245
-
1246
- try {
1247
- root = Yoga.Node.create(config)
1248
- root.setAlignItems(Align.Center)
1249
- root.setPositionType(PositionType.Absolute)
1250
- root.setWidth(200)
1251
- root.setHeight(200)
1252
-
1253
- const root_child0 = Yoga.Node.create(config)
1254
- root_child0.setMargin(Edge.Left, "auto")
1255
- root_child0.setWidth(50)
1256
- root_child0.setHeight(50)
1257
- root.insertChild(root_child0, 0)
1258
-
1259
- const root_child1 = Yoga.Node.create(config)
1260
- root_child1.setWidth(50)
1261
- root_child1.setHeight(50)
1262
- root.insertChild(root_child1, 1)
1263
- root.calculateLayout(undefined, undefined, Direction.LTR)
1264
-
1265
- expect(root.getComputedLeft()).toBe(0)
1266
- expect(root.getComputedTop()).toBe(0)
1267
- expect(root.getComputedWidth()).toBe(200)
1268
- expect(root.getComputedHeight()).toBe(200)
1269
-
1270
- expect(root_child0.getComputedLeft()).toBe(150)
1271
- expect(root_child0.getComputedTop()).toBe(0)
1272
- expect(root_child0.getComputedWidth()).toBe(50)
1273
- expect(root_child0.getComputedHeight()).toBe(50)
1274
-
1275
- expect(root_child1.getComputedLeft()).toBe(75)
1276
- expect(root_child1.getComputedTop()).toBe(50)
1277
- expect(root_child1.getComputedWidth()).toBe(50)
1278
- expect(root_child1.getComputedHeight()).toBe(50)
1279
-
1280
- root.calculateLayout(undefined, undefined, Direction.RTL)
1281
-
1282
- expect(root.getComputedLeft()).toBe(0)
1283
- expect(root.getComputedTop()).toBe(0)
1284
- expect(root.getComputedWidth()).toBe(200)
1285
- expect(root.getComputedHeight()).toBe(200)
1286
-
1287
- expect(root_child0.getComputedLeft()).toBe(150)
1288
- expect(root_child0.getComputedTop()).toBe(0)
1289
- expect(root_child0.getComputedWidth()).toBe(50)
1290
- expect(root_child0.getComputedHeight()).toBe(50)
1291
-
1292
- expect(root_child1.getComputedLeft()).toBe(75)
1293
- expect(root_child1.getComputedTop()).toBe(50)
1294
- expect(root_child1.getComputedWidth()).toBe(50)
1295
- expect(root_child1.getComputedHeight()).toBe(50)
1296
- } finally {
1297
- if (typeof root !== "undefined") {
1298
- root.freeRecursive()
1299
- }
1300
-
1301
- config.free()
1302
- }
1303
- })
1304
- test("margin_auto_right", () => {
1305
- const config = Yoga.Config.create()
1306
- let root
1307
-
1308
- try {
1309
- root = Yoga.Node.create(config)
1310
- root.setAlignItems(Align.Center)
1311
- root.setPositionType(PositionType.Absolute)
1312
- root.setWidth(200)
1313
- root.setHeight(200)
1314
-
1315
- const root_child0 = Yoga.Node.create(config)
1316
- root_child0.setMargin(Edge.Right, "auto")
1317
- root_child0.setWidth(50)
1318
- root_child0.setHeight(50)
1319
- root.insertChild(root_child0, 0)
1320
-
1321
- const root_child1 = Yoga.Node.create(config)
1322
- root_child1.setWidth(50)
1323
- root_child1.setHeight(50)
1324
- root.insertChild(root_child1, 1)
1325
- root.calculateLayout(undefined, undefined, Direction.LTR)
1326
-
1327
- expect(root.getComputedLeft()).toBe(0)
1328
- expect(root.getComputedTop()).toBe(0)
1329
- expect(root.getComputedWidth()).toBe(200)
1330
- expect(root.getComputedHeight()).toBe(200)
1331
-
1332
- expect(root_child0.getComputedLeft()).toBe(0)
1333
- expect(root_child0.getComputedTop()).toBe(0)
1334
- expect(root_child0.getComputedWidth()).toBe(50)
1335
- expect(root_child0.getComputedHeight()).toBe(50)
1336
-
1337
- expect(root_child1.getComputedLeft()).toBe(75)
1338
- expect(root_child1.getComputedTop()).toBe(50)
1339
- expect(root_child1.getComputedWidth()).toBe(50)
1340
- expect(root_child1.getComputedHeight()).toBe(50)
1341
-
1342
- root.calculateLayout(undefined, undefined, Direction.RTL)
1343
-
1344
- expect(root.getComputedLeft()).toBe(0)
1345
- expect(root.getComputedTop()).toBe(0)
1346
- expect(root.getComputedWidth()).toBe(200)
1347
- expect(root.getComputedHeight()).toBe(200)
1348
-
1349
- expect(root_child0.getComputedLeft()).toBe(0)
1350
- expect(root_child0.getComputedTop()).toBe(0)
1351
- expect(root_child0.getComputedWidth()).toBe(50)
1352
- expect(root_child0.getComputedHeight()).toBe(50)
1353
-
1354
- expect(root_child1.getComputedLeft()).toBe(75)
1355
- expect(root_child1.getComputedTop()).toBe(50)
1356
- expect(root_child1.getComputedWidth()).toBe(50)
1357
- expect(root_child1.getComputedHeight()).toBe(50)
1358
- } finally {
1359
- if (typeof root !== "undefined") {
1360
- root.freeRecursive()
1361
- }
1362
-
1363
- config.free()
1364
- }
1365
- })
1366
- test("margin_auto_left_and_right_stretch", () => {
1367
- const config = Yoga.Config.create()
1368
- let root
1369
-
1370
- try {
1371
- root = Yoga.Node.create(config)
1372
- root.setFlexDirection(FlexDirection.Row)
1373
- root.setPositionType(PositionType.Absolute)
1374
- root.setWidth(200)
1375
- root.setHeight(200)
1376
-
1377
- const root_child0 = Yoga.Node.create(config)
1378
- root_child0.setMargin(Edge.Left, "auto")
1379
- root_child0.setMargin(Edge.Right, "auto")
1380
- root_child0.setWidth(50)
1381
- root_child0.setHeight(50)
1382
- root.insertChild(root_child0, 0)
1383
-
1384
- const root_child1 = Yoga.Node.create(config)
1385
- root_child1.setWidth(50)
1386
- root_child1.setHeight(50)
1387
- root.insertChild(root_child1, 1)
1388
- root.calculateLayout(undefined, undefined, Direction.LTR)
1389
-
1390
- expect(root.getComputedLeft()).toBe(0)
1391
- expect(root.getComputedTop()).toBe(0)
1392
- expect(root.getComputedWidth()).toBe(200)
1393
- expect(root.getComputedHeight()).toBe(200)
1394
-
1395
- expect(root_child0.getComputedLeft()).toBe(50)
1396
- expect(root_child0.getComputedTop()).toBe(0)
1397
- expect(root_child0.getComputedWidth()).toBe(50)
1398
- expect(root_child0.getComputedHeight()).toBe(50)
1399
-
1400
- expect(root_child1.getComputedLeft()).toBe(150)
1401
- expect(root_child1.getComputedTop()).toBe(0)
1402
- expect(root_child1.getComputedWidth()).toBe(50)
1403
- expect(root_child1.getComputedHeight()).toBe(50)
1404
-
1405
- root.calculateLayout(undefined, undefined, Direction.RTL)
1406
-
1407
- expect(root.getComputedLeft()).toBe(0)
1408
- expect(root.getComputedTop()).toBe(0)
1409
- expect(root.getComputedWidth()).toBe(200)
1410
- expect(root.getComputedHeight()).toBe(200)
1411
-
1412
- expect(root_child0.getComputedLeft()).toBe(100)
1413
- expect(root_child0.getComputedTop()).toBe(0)
1414
- expect(root_child0.getComputedWidth()).toBe(50)
1415
- expect(root_child0.getComputedHeight()).toBe(50)
1416
-
1417
- expect(root_child1.getComputedLeft()).toBe(0)
1418
- expect(root_child1.getComputedTop()).toBe(0)
1419
- expect(root_child1.getComputedWidth()).toBe(50)
1420
- expect(root_child1.getComputedHeight()).toBe(50)
1421
- } finally {
1422
- if (typeof root !== "undefined") {
1423
- root.freeRecursive()
1424
- }
1425
-
1426
- config.free()
1427
- }
1428
- })
1429
- test("margin_auto_top_and_bottom_stretch", () => {
1430
- const config = Yoga.Config.create()
1431
- let root
1432
-
1433
- try {
1434
- root = Yoga.Node.create(config)
1435
- root.setPositionType(PositionType.Absolute)
1436
- root.setWidth(200)
1437
- root.setHeight(200)
1438
-
1439
- const root_child0 = Yoga.Node.create(config)
1440
- root_child0.setMargin(Edge.Top, "auto")
1441
- root_child0.setMargin(Edge.Bottom, "auto")
1442
- root_child0.setWidth(50)
1443
- root_child0.setHeight(50)
1444
- root.insertChild(root_child0, 0)
1445
-
1446
- const root_child1 = Yoga.Node.create(config)
1447
- root_child1.setWidth(50)
1448
- root_child1.setHeight(50)
1449
- root.insertChild(root_child1, 1)
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(200)
1455
- expect(root.getComputedHeight()).toBe(200)
1456
-
1457
- expect(root_child0.getComputedLeft()).toBe(0)
1458
- expect(root_child0.getComputedTop()).toBe(50)
1459
- expect(root_child0.getComputedWidth()).toBe(50)
1460
- expect(root_child0.getComputedHeight()).toBe(50)
1461
-
1462
- expect(root_child1.getComputedLeft()).toBe(0)
1463
- expect(root_child1.getComputedTop()).toBe(150)
1464
- expect(root_child1.getComputedWidth()).toBe(50)
1465
- expect(root_child1.getComputedHeight()).toBe(50)
1466
-
1467
- root.calculateLayout(undefined, undefined, Direction.RTL)
1468
-
1469
- expect(root.getComputedLeft()).toBe(0)
1470
- expect(root.getComputedTop()).toBe(0)
1471
- expect(root.getComputedWidth()).toBe(200)
1472
- expect(root.getComputedHeight()).toBe(200)
1473
-
1474
- expect(root_child0.getComputedLeft()).toBe(150)
1475
- expect(root_child0.getComputedTop()).toBe(50)
1476
- expect(root_child0.getComputedWidth()).toBe(50)
1477
- expect(root_child0.getComputedHeight()).toBe(50)
1478
-
1479
- expect(root_child1.getComputedLeft()).toBe(150)
1480
- expect(root_child1.getComputedTop()).toBe(150)
1481
- expect(root_child1.getComputedWidth()).toBe(50)
1482
- expect(root_child1.getComputedHeight()).toBe(50)
1483
- } finally {
1484
- if (typeof root !== "undefined") {
1485
- root.freeRecursive()
1486
- }
1487
-
1488
- config.free()
1489
- }
1490
- })
1491
- test("margin_should_not_be_part_of_max_height", () => {
1492
- const config = Yoga.Config.create()
1493
- let root
1494
-
1495
- try {
1496
- root = Yoga.Node.create(config)
1497
- root.setPositionType(PositionType.Absolute)
1498
- root.setWidth(250)
1499
- root.setHeight(250)
1500
-
1501
- const root_child0 = Yoga.Node.create(config)
1502
- root_child0.setMargin(Edge.Top, 20)
1503
- root_child0.setWidth(100)
1504
- root_child0.setHeight(100)
1505
- root_child0.setMaxHeight(100)
1506
- root.insertChild(root_child0, 0)
1507
- root.calculateLayout(undefined, undefined, Direction.LTR)
1508
-
1509
- expect(root.getComputedLeft()).toBe(0)
1510
- expect(root.getComputedTop()).toBe(0)
1511
- expect(root.getComputedWidth()).toBe(250)
1512
- expect(root.getComputedHeight()).toBe(250)
1513
-
1514
- expect(root_child0.getComputedLeft()).toBe(0)
1515
- expect(root_child0.getComputedTop()).toBe(20)
1516
- expect(root_child0.getComputedWidth()).toBe(100)
1517
- expect(root_child0.getComputedHeight()).toBe(100)
1518
-
1519
- root.calculateLayout(undefined, undefined, Direction.RTL)
1520
-
1521
- expect(root.getComputedLeft()).toBe(0)
1522
- expect(root.getComputedTop()).toBe(0)
1523
- expect(root.getComputedWidth()).toBe(250)
1524
- expect(root.getComputedHeight()).toBe(250)
1525
-
1526
- expect(root_child0.getComputedLeft()).toBe(150)
1527
- expect(root_child0.getComputedTop()).toBe(20)
1528
- expect(root_child0.getComputedWidth()).toBe(100)
1529
- expect(root_child0.getComputedHeight()).toBe(100)
1530
- } finally {
1531
- if (typeof root !== "undefined") {
1532
- root.freeRecursive()
1533
- }
1534
-
1535
- config.free()
1536
- }
1537
- })
1538
- test("margin_should_not_be_part_of_max_width", () => {
1539
- const config = Yoga.Config.create()
1540
- let root
1541
-
1542
- try {
1543
- root = Yoga.Node.create(config)
1544
- root.setPositionType(PositionType.Absolute)
1545
- root.setWidth(250)
1546
- root.setHeight(250)
1547
-
1548
- const root_child0 = Yoga.Node.create(config)
1549
- root_child0.setMargin(Edge.Left, 20)
1550
- root_child0.setWidth(100)
1551
- root_child0.setMaxWidth(100)
1552
- root_child0.setHeight(100)
1553
- root.insertChild(root_child0, 0)
1554
- root.calculateLayout(undefined, undefined, Direction.LTR)
1555
-
1556
- expect(root.getComputedLeft()).toBe(0)
1557
- expect(root.getComputedTop()).toBe(0)
1558
- expect(root.getComputedWidth()).toBe(250)
1559
- expect(root.getComputedHeight()).toBe(250)
1560
-
1561
- expect(root_child0.getComputedLeft()).toBe(20)
1562
- expect(root_child0.getComputedTop()).toBe(0)
1563
- expect(root_child0.getComputedWidth()).toBe(100)
1564
- expect(root_child0.getComputedHeight()).toBe(100)
1565
-
1566
- root.calculateLayout(undefined, undefined, Direction.RTL)
1567
-
1568
- expect(root.getComputedLeft()).toBe(0)
1569
- expect(root.getComputedTop()).toBe(0)
1570
- expect(root.getComputedWidth()).toBe(250)
1571
- expect(root.getComputedHeight()).toBe(250)
1572
-
1573
- expect(root_child0.getComputedLeft()).toBe(150)
1574
- expect(root_child0.getComputedTop()).toBe(0)
1575
- expect(root_child0.getComputedWidth()).toBe(100)
1576
- expect(root_child0.getComputedHeight()).toBe(100)
1577
- } finally {
1578
- if (typeof root !== "undefined") {
1579
- root.freeRecursive()
1580
- }
1581
-
1582
- config.free()
1583
- }
1584
- })
1585
- test("margin_auto_left_right_child_bigger_than_parent", () => {
1586
- const config = Yoga.Config.create()
1587
- let root
1588
-
1589
- try {
1590
- root = Yoga.Node.create(config)
1591
- root.setJustifyContent(Justify.Center)
1592
- root.setPositionType(PositionType.Absolute)
1593
- root.setWidth(52)
1594
- root.setHeight(52)
1595
-
1596
- const root_child0 = Yoga.Node.create(config)
1597
- root_child0.setMargin(Edge.Left, "auto")
1598
- root_child0.setMargin(Edge.Right, "auto")
1599
- root_child0.setWidth(72)
1600
- root_child0.setHeight(72)
1601
- root.insertChild(root_child0, 0)
1602
- root.calculateLayout(undefined, undefined, Direction.LTR)
1603
-
1604
- expect(root.getComputedLeft()).toBe(0)
1605
- expect(root.getComputedTop()).toBe(0)
1606
- expect(root.getComputedWidth()).toBe(52)
1607
- expect(root.getComputedHeight()).toBe(52)
1608
-
1609
- expect(root_child0.getComputedLeft()).toBe(0)
1610
- expect(root_child0.getComputedTop()).toBe(-10)
1611
- expect(root_child0.getComputedWidth()).toBe(72)
1612
- expect(root_child0.getComputedHeight()).toBe(72)
1613
-
1614
- root.calculateLayout(undefined, undefined, Direction.RTL)
1615
-
1616
- expect(root.getComputedLeft()).toBe(0)
1617
- expect(root.getComputedTop()).toBe(0)
1618
- expect(root.getComputedWidth()).toBe(52)
1619
- expect(root.getComputedHeight()).toBe(52)
1620
-
1621
- expect(root_child0.getComputedLeft()).toBe(-20)
1622
- expect(root_child0.getComputedTop()).toBe(-10)
1623
- expect(root_child0.getComputedWidth()).toBe(72)
1624
- expect(root_child0.getComputedHeight()).toBe(72)
1625
- } finally {
1626
- if (typeof root !== "undefined") {
1627
- root.freeRecursive()
1628
- }
1629
-
1630
- config.free()
1631
- }
1632
- })
1633
- test("margin_auto_left_child_bigger_than_parent", () => {
1634
- const config = Yoga.Config.create()
1635
- let root
1636
-
1637
- try {
1638
- root = Yoga.Node.create(config)
1639
- root.setJustifyContent(Justify.Center)
1640
- root.setPositionType(PositionType.Absolute)
1641
- root.setWidth(52)
1642
- root.setHeight(52)
1643
-
1644
- const root_child0 = Yoga.Node.create(config)
1645
- root_child0.setMargin(Edge.Left, "auto")
1646
- root_child0.setWidth(72)
1647
- root_child0.setHeight(72)
1648
- root.insertChild(root_child0, 0)
1649
- root.calculateLayout(undefined, undefined, Direction.LTR)
1650
-
1651
- expect(root.getComputedLeft()).toBe(0)
1652
- expect(root.getComputedTop()).toBe(0)
1653
- expect(root.getComputedWidth()).toBe(52)
1654
- expect(root.getComputedHeight()).toBe(52)
1655
-
1656
- expect(root_child0.getComputedLeft()).toBe(0)
1657
- expect(root_child0.getComputedTop()).toBe(-10)
1658
- expect(root_child0.getComputedWidth()).toBe(72)
1659
- expect(root_child0.getComputedHeight()).toBe(72)
1660
-
1661
- root.calculateLayout(undefined, undefined, Direction.RTL)
1662
-
1663
- expect(root.getComputedLeft()).toBe(0)
1664
- expect(root.getComputedTop()).toBe(0)
1665
- expect(root.getComputedWidth()).toBe(52)
1666
- expect(root.getComputedHeight()).toBe(52)
1667
-
1668
- expect(root_child0.getComputedLeft()).toBe(-20)
1669
- expect(root_child0.getComputedTop()).toBe(-10)
1670
- expect(root_child0.getComputedWidth()).toBe(72)
1671
- expect(root_child0.getComputedHeight()).toBe(72)
1672
- } finally {
1673
- if (typeof root !== "undefined") {
1674
- root.freeRecursive()
1675
- }
1676
-
1677
- config.free()
1678
- }
1679
- })
1680
- test("margin_fix_left_auto_right_child_bigger_than_parent", () => {
1681
- const config = Yoga.Config.create()
1682
- let root
1683
-
1684
- try {
1685
- root = Yoga.Node.create(config)
1686
- root.setJustifyContent(Justify.Center)
1687
- root.setPositionType(PositionType.Absolute)
1688
- root.setWidth(52)
1689
- root.setHeight(52)
1690
-
1691
- const root_child0 = Yoga.Node.create(config)
1692
- root_child0.setMargin(Edge.Left, 10)
1693
- root_child0.setMargin(Edge.Right, "auto")
1694
- root_child0.setWidth(72)
1695
- root_child0.setHeight(72)
1696
- root.insertChild(root_child0, 0)
1697
- root.calculateLayout(undefined, undefined, Direction.LTR)
1698
-
1699
- expect(root.getComputedLeft()).toBe(0)
1700
- expect(root.getComputedTop()).toBe(0)
1701
- expect(root.getComputedWidth()).toBe(52)
1702
- expect(root.getComputedHeight()).toBe(52)
1703
-
1704
- expect(root_child0.getComputedLeft()).toBe(10)
1705
- expect(root_child0.getComputedTop()).toBe(-10)
1706
- expect(root_child0.getComputedWidth()).toBe(72)
1707
- expect(root_child0.getComputedHeight()).toBe(72)
1708
-
1709
- root.calculateLayout(undefined, undefined, Direction.RTL)
1710
-
1711
- expect(root.getComputedLeft()).toBe(0)
1712
- expect(root.getComputedTop()).toBe(0)
1713
- expect(root.getComputedWidth()).toBe(52)
1714
- expect(root.getComputedHeight()).toBe(52)
1715
-
1716
- expect(root_child0.getComputedLeft()).toBe(-20)
1717
- expect(root_child0.getComputedTop()).toBe(-10)
1718
- expect(root_child0.getComputedWidth()).toBe(72)
1719
- expect(root_child0.getComputedHeight()).toBe(72)
1720
- } finally {
1721
- if (typeof root !== "undefined") {
1722
- root.freeRecursive()
1723
- }
1724
-
1725
- config.free()
1726
- }
1727
- })
1728
- test("margin_auto_left_fix_right_child_bigger_than_parent", () => {
1729
- const config = Yoga.Config.create()
1730
- let root
1731
-
1732
- try {
1733
- root = Yoga.Node.create(config)
1734
- root.setJustifyContent(Justify.Center)
1735
- root.setPositionType(PositionType.Absolute)
1736
- root.setWidth(52)
1737
- root.setHeight(52)
1738
-
1739
- const root_child0 = Yoga.Node.create(config)
1740
- root_child0.setMargin(Edge.Left, "auto")
1741
- root_child0.setMargin(Edge.Right, 10)
1742
- root_child0.setWidth(72)
1743
- root_child0.setHeight(72)
1744
- root.insertChild(root_child0, 0)
1745
- root.calculateLayout(undefined, undefined, Direction.LTR)
1746
-
1747
- expect(root.getComputedLeft()).toBe(0)
1748
- expect(root.getComputedTop()).toBe(0)
1749
- expect(root.getComputedWidth()).toBe(52)
1750
- expect(root.getComputedHeight()).toBe(52)
1751
-
1752
- expect(root_child0.getComputedLeft()).toBe(0)
1753
- expect(root_child0.getComputedTop()).toBe(-10)
1754
- expect(root_child0.getComputedWidth()).toBe(72)
1755
- expect(root_child0.getComputedHeight()).toBe(72)
1756
-
1757
- root.calculateLayout(undefined, undefined, Direction.RTL)
1758
-
1759
- expect(root.getComputedLeft()).toBe(0)
1760
- expect(root.getComputedTop()).toBe(0)
1761
- expect(root.getComputedWidth()).toBe(52)
1762
- expect(root.getComputedHeight()).toBe(52)
1763
-
1764
- expect(root_child0.getComputedLeft()).toBe(-30)
1765
- expect(root_child0.getComputedTop()).toBe(-10)
1766
- expect(root_child0.getComputedWidth()).toBe(72)
1767
- expect(root_child0.getComputedHeight()).toBe(72)
1768
- } finally {
1769
- if (typeof root !== "undefined") {
1770
- root.freeRecursive()
1771
- }
1772
-
1773
- config.free()
1774
- }
1775
- })
1776
- test("margin_auto_top_stretching_child", () => {
1777
- const config = Yoga.Config.create()
1778
- let root
1779
-
1780
- try {
1781
- root = Yoga.Node.create(config)
1782
- root.setAlignItems(Align.Center)
1783
- root.setPositionType(PositionType.Absolute)
1784
- root.setWidth(200)
1785
- root.setHeight(200)
1786
-
1787
- const root_child0 = Yoga.Node.create(config)
1788
- root_child0.setFlexGrow(1)
1789
- root_child0.setFlexShrink(1)
1790
- root_child0.setFlexBasis("0%")
1791
- root_child0.setMargin(Edge.Top, "auto")
1792
- root.insertChild(root_child0, 0)
1793
-
1794
- const root_child1 = Yoga.Node.create(config)
1795
- root_child1.setWidth(50)
1796
- root_child1.setHeight(50)
1797
- root.insertChild(root_child1, 1)
1798
- root.calculateLayout(undefined, undefined, Direction.LTR)
1799
-
1800
- expect(root.getComputedLeft()).toBe(0)
1801
- expect(root.getComputedTop()).toBe(0)
1802
- expect(root.getComputedWidth()).toBe(200)
1803
- expect(root.getComputedHeight()).toBe(200)
1804
-
1805
- expect(root_child0.getComputedLeft()).toBe(100)
1806
- expect(root_child0.getComputedTop()).toBe(0)
1807
- expect(root_child0.getComputedWidth()).toBe(0)
1808
- expect(root_child0.getComputedHeight()).toBe(150)
1809
-
1810
- expect(root_child1.getComputedLeft()).toBe(75)
1811
- expect(root_child1.getComputedTop()).toBe(150)
1812
- expect(root_child1.getComputedWidth()).toBe(50)
1813
- expect(root_child1.getComputedHeight()).toBe(50)
1814
-
1815
- root.calculateLayout(undefined, undefined, Direction.RTL)
1816
-
1817
- expect(root.getComputedLeft()).toBe(0)
1818
- expect(root.getComputedTop()).toBe(0)
1819
- expect(root.getComputedWidth()).toBe(200)
1820
- expect(root.getComputedHeight()).toBe(200)
1821
-
1822
- expect(root_child0.getComputedLeft()).toBe(100)
1823
- expect(root_child0.getComputedTop()).toBe(0)
1824
- expect(root_child0.getComputedWidth()).toBe(0)
1825
- expect(root_child0.getComputedHeight()).toBe(150)
1826
-
1827
- expect(root_child1.getComputedLeft()).toBe(75)
1828
- expect(root_child1.getComputedTop()).toBe(150)
1829
- expect(root_child1.getComputedWidth()).toBe(50)
1830
- expect(root_child1.getComputedHeight()).toBe(50)
1831
- } finally {
1832
- if (typeof root !== "undefined") {
1833
- root.freeRecursive()
1834
- }
1835
-
1836
- config.free()
1837
- }
1838
- })
1839
- test("margin_auto_left_stretching_child", () => {
1840
- const config = Yoga.Config.create()
1841
- let root
1842
-
1843
- try {
1844
- root = Yoga.Node.create(config)
1845
- root.setAlignItems(Align.Center)
1846
- root.setPositionType(PositionType.Absolute)
1847
- root.setWidth(200)
1848
- root.setHeight(200)
1849
-
1850
- const root_child0 = Yoga.Node.create(config)
1851
- root_child0.setFlexGrow(1)
1852
- root_child0.setFlexShrink(1)
1853
- root_child0.setFlexBasis("0%")
1854
- root_child0.setMargin(Edge.Left, "auto")
1855
- root.insertChild(root_child0, 0)
1856
-
1857
- const root_child1 = Yoga.Node.create(config)
1858
- root_child1.setWidth(50)
1859
- root_child1.setHeight(50)
1860
- root.insertChild(root_child1, 1)
1861
- root.calculateLayout(undefined, undefined, Direction.LTR)
1862
-
1863
- expect(root.getComputedLeft()).toBe(0)
1864
- expect(root.getComputedTop()).toBe(0)
1865
- expect(root.getComputedWidth()).toBe(200)
1866
- expect(root.getComputedHeight()).toBe(200)
1867
-
1868
- expect(root_child0.getComputedLeft()).toBe(200)
1869
- expect(root_child0.getComputedTop()).toBe(0)
1870
- expect(root_child0.getComputedWidth()).toBe(0)
1871
- expect(root_child0.getComputedHeight()).toBe(150)
1872
-
1873
- expect(root_child1.getComputedLeft()).toBe(75)
1874
- expect(root_child1.getComputedTop()).toBe(150)
1875
- expect(root_child1.getComputedWidth()).toBe(50)
1876
- expect(root_child1.getComputedHeight()).toBe(50)
1877
-
1878
- root.calculateLayout(undefined, undefined, Direction.RTL)
1879
-
1880
- expect(root.getComputedLeft()).toBe(0)
1881
- expect(root.getComputedTop()).toBe(0)
1882
- expect(root.getComputedWidth()).toBe(200)
1883
- expect(root.getComputedHeight()).toBe(200)
1884
-
1885
- expect(root_child0.getComputedLeft()).toBe(200)
1886
- expect(root_child0.getComputedTop()).toBe(0)
1887
- expect(root_child0.getComputedWidth()).toBe(0)
1888
- expect(root_child0.getComputedHeight()).toBe(150)
1889
-
1890
- expect(root_child1.getComputedLeft()).toBe(75)
1891
- expect(root_child1.getComputedTop()).toBe(150)
1892
- expect(root_child1.getComputedWidth()).toBe(50)
1893
- expect(root_child1.getComputedHeight()).toBe(50)
1894
- } finally {
1895
- if (typeof root !== "undefined") {
1896
- root.freeRecursive()
1897
- }
1898
-
1899
- config.free()
1900
- }
1901
- })
1902
- test("margin_auto_overflowing_container", () => {
1903
- const config = Yoga.Config.create()
1904
- let root
1905
-
1906
- try {
1907
- root = Yoga.Node.create(config)
1908
- root.setAlignItems(Align.Center)
1909
- root.setPositionType(PositionType.Absolute)
1910
- root.setWidth(200)
1911
- root.setHeight(200)
1912
-
1913
- const root_child0 = Yoga.Node.create(config)
1914
- root_child0.setMargin(Edge.Bottom, "auto")
1915
- root_child0.setWidth(50)
1916
- root_child0.setHeight(150)
1917
- root.insertChild(root_child0, 0)
1918
-
1919
- const root_child1 = Yoga.Node.create(config)
1920
- root_child1.setWidth(50)
1921
- root_child1.setHeight(150)
1922
- root.insertChild(root_child1, 1)
1923
- root.calculateLayout(undefined, undefined, Direction.LTR)
1924
-
1925
- expect(root.getComputedLeft()).toBe(0)
1926
- expect(root.getComputedTop()).toBe(0)
1927
- expect(root.getComputedWidth()).toBe(200)
1928
- expect(root.getComputedHeight()).toBe(200)
1929
-
1930
- expect(root_child0.getComputedLeft()).toBe(75)
1931
- expect(root_child0.getComputedTop()).toBe(0)
1932
- expect(root_child0.getComputedWidth()).toBe(50)
1933
- expect(root_child0.getComputedHeight()).toBe(150)
1934
-
1935
- expect(root_child1.getComputedLeft()).toBe(75)
1936
- expect(root_child1.getComputedTop()).toBe(150)
1937
- expect(root_child1.getComputedWidth()).toBe(50)
1938
- expect(root_child1.getComputedHeight()).toBe(150)
1939
-
1940
- root.calculateLayout(undefined, undefined, Direction.RTL)
1941
-
1942
- expect(root.getComputedLeft()).toBe(0)
1943
- expect(root.getComputedTop()).toBe(0)
1944
- expect(root.getComputedWidth()).toBe(200)
1945
- expect(root.getComputedHeight()).toBe(200)
1946
-
1947
- expect(root_child0.getComputedLeft()).toBe(75)
1948
- expect(root_child0.getComputedTop()).toBe(0)
1949
- expect(root_child0.getComputedWidth()).toBe(50)
1950
- expect(root_child0.getComputedHeight()).toBe(150)
1951
-
1952
- expect(root_child1.getComputedLeft()).toBe(75)
1953
- expect(root_child1.getComputedTop()).toBe(150)
1954
- expect(root_child1.getComputedWidth()).toBe(50)
1955
- expect(root_child1.getComputedHeight()).toBe(150)
1956
- } finally {
1957
- if (typeof root !== "undefined") {
1958
- root.freeRecursive()
1959
- }
1960
-
1961
- config.free()
1962
- }
1963
- })