@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,2444 +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<<075a0b67003e5c4a1f51bd99da71c700>>
8
- * generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.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("align_items_stretch", () => {
32
- const config = Yoga.Config.create()
33
- let root
34
-
35
- try {
36
- root = Yoga.Node.create(config)
37
- root.setPositionType(PositionType.Absolute)
38
- root.setWidth(100)
39
- root.setHeight(100)
40
-
41
- const root_child0 = Yoga.Node.create(config)
42
- root_child0.setHeight(10)
43
- root.insertChild(root_child0, 0)
44
- root.calculateLayout(undefined, undefined, Direction.LTR)
45
-
46
- expect(root.getComputedLeft()).toBe(0)
47
- expect(root.getComputedTop()).toBe(0)
48
- expect(root.getComputedWidth()).toBe(100)
49
- expect(root.getComputedHeight()).toBe(100)
50
-
51
- expect(root_child0.getComputedLeft()).toBe(0)
52
- expect(root_child0.getComputedTop()).toBe(0)
53
- expect(root_child0.getComputedWidth()).toBe(100)
54
- expect(root_child0.getComputedHeight()).toBe(10)
55
-
56
- root.calculateLayout(undefined, undefined, Direction.RTL)
57
-
58
- expect(root.getComputedLeft()).toBe(0)
59
- expect(root.getComputedTop()).toBe(0)
60
- expect(root.getComputedWidth()).toBe(100)
61
- expect(root.getComputedHeight()).toBe(100)
62
-
63
- expect(root_child0.getComputedLeft()).toBe(0)
64
- expect(root_child0.getComputedTop()).toBe(0)
65
- expect(root_child0.getComputedWidth()).toBe(100)
66
- expect(root_child0.getComputedHeight()).toBe(10)
67
- } finally {
68
- if (typeof root !== "undefined") {
69
- root.freeRecursive()
70
- }
71
-
72
- config.free()
73
- }
74
- })
75
- test("align_items_center", () => {
76
- const config = Yoga.Config.create()
77
- let root
78
-
79
- try {
80
- root = Yoga.Node.create(config)
81
- root.setAlignItems(Align.Center)
82
- root.setPositionType(PositionType.Absolute)
83
- root.setWidth(100)
84
- root.setHeight(100)
85
-
86
- const root_child0 = Yoga.Node.create(config)
87
- root_child0.setWidth(10)
88
- root_child0.setHeight(10)
89
- root.insertChild(root_child0, 0)
90
- root.calculateLayout(undefined, undefined, Direction.LTR)
91
-
92
- expect(root.getComputedLeft()).toBe(0)
93
- expect(root.getComputedTop()).toBe(0)
94
- expect(root.getComputedWidth()).toBe(100)
95
- expect(root.getComputedHeight()).toBe(100)
96
-
97
- expect(root_child0.getComputedLeft()).toBe(45)
98
- expect(root_child0.getComputedTop()).toBe(0)
99
- expect(root_child0.getComputedWidth()).toBe(10)
100
- expect(root_child0.getComputedHeight()).toBe(10)
101
-
102
- root.calculateLayout(undefined, undefined, Direction.RTL)
103
-
104
- expect(root.getComputedLeft()).toBe(0)
105
- expect(root.getComputedTop()).toBe(0)
106
- expect(root.getComputedWidth()).toBe(100)
107
- expect(root.getComputedHeight()).toBe(100)
108
-
109
- expect(root_child0.getComputedLeft()).toBe(45)
110
- expect(root_child0.getComputedTop()).toBe(0)
111
- expect(root_child0.getComputedWidth()).toBe(10)
112
- expect(root_child0.getComputedHeight()).toBe(10)
113
- } finally {
114
- if (typeof root !== "undefined") {
115
- root.freeRecursive()
116
- }
117
-
118
- config.free()
119
- }
120
- })
121
- test("align_items_flex_start", () => {
122
- const config = Yoga.Config.create()
123
- let root
124
-
125
- try {
126
- root = Yoga.Node.create(config)
127
- root.setAlignItems(Align.FlexStart)
128
- root.setPositionType(PositionType.Absolute)
129
- root.setWidth(100)
130
- root.setHeight(100)
131
-
132
- const root_child0 = Yoga.Node.create(config)
133
- root_child0.setWidth(10)
134
- root_child0.setHeight(10)
135
- root.insertChild(root_child0, 0)
136
- root.calculateLayout(undefined, undefined, Direction.LTR)
137
-
138
- expect(root.getComputedLeft()).toBe(0)
139
- expect(root.getComputedTop()).toBe(0)
140
- expect(root.getComputedWidth()).toBe(100)
141
- expect(root.getComputedHeight()).toBe(100)
142
-
143
- expect(root_child0.getComputedLeft()).toBe(0)
144
- expect(root_child0.getComputedTop()).toBe(0)
145
- expect(root_child0.getComputedWidth()).toBe(10)
146
- expect(root_child0.getComputedHeight()).toBe(10)
147
-
148
- root.calculateLayout(undefined, undefined, Direction.RTL)
149
-
150
- expect(root.getComputedLeft()).toBe(0)
151
- expect(root.getComputedTop()).toBe(0)
152
- expect(root.getComputedWidth()).toBe(100)
153
- expect(root.getComputedHeight()).toBe(100)
154
-
155
- expect(root_child0.getComputedLeft()).toBe(90)
156
- expect(root_child0.getComputedTop()).toBe(0)
157
- expect(root_child0.getComputedWidth()).toBe(10)
158
- expect(root_child0.getComputedHeight()).toBe(10)
159
- } finally {
160
- if (typeof root !== "undefined") {
161
- root.freeRecursive()
162
- }
163
-
164
- config.free()
165
- }
166
- })
167
- test("align_items_flex_end", () => {
168
- const config = Yoga.Config.create()
169
- let root
170
-
171
- try {
172
- root = Yoga.Node.create(config)
173
- root.setAlignItems(Align.FlexEnd)
174
- root.setPositionType(PositionType.Absolute)
175
- root.setWidth(100)
176
- root.setHeight(100)
177
-
178
- const root_child0 = Yoga.Node.create(config)
179
- root_child0.setWidth(10)
180
- root_child0.setHeight(10)
181
- root.insertChild(root_child0, 0)
182
- root.calculateLayout(undefined, undefined, Direction.LTR)
183
-
184
- expect(root.getComputedLeft()).toBe(0)
185
- expect(root.getComputedTop()).toBe(0)
186
- expect(root.getComputedWidth()).toBe(100)
187
- expect(root.getComputedHeight()).toBe(100)
188
-
189
- expect(root_child0.getComputedLeft()).toBe(90)
190
- expect(root_child0.getComputedTop()).toBe(0)
191
- expect(root_child0.getComputedWidth()).toBe(10)
192
- expect(root_child0.getComputedHeight()).toBe(10)
193
-
194
- root.calculateLayout(undefined, undefined, Direction.RTL)
195
-
196
- expect(root.getComputedLeft()).toBe(0)
197
- expect(root.getComputedTop()).toBe(0)
198
- expect(root.getComputedWidth()).toBe(100)
199
- expect(root.getComputedHeight()).toBe(100)
200
-
201
- expect(root_child0.getComputedLeft()).toBe(0)
202
- expect(root_child0.getComputedTop()).toBe(0)
203
- expect(root_child0.getComputedWidth()).toBe(10)
204
- expect(root_child0.getComputedHeight()).toBe(10)
205
- } finally {
206
- if (typeof root !== "undefined") {
207
- root.freeRecursive()
208
- }
209
-
210
- config.free()
211
- }
212
- })
213
- test("align_baseline", () => {
214
- const config = Yoga.Config.create()
215
- let root
216
-
217
- try {
218
- root = Yoga.Node.create(config)
219
- root.setFlexDirection(FlexDirection.Row)
220
- root.setAlignItems(Align.Baseline)
221
- root.setPositionType(PositionType.Absolute)
222
- root.setWidth(100)
223
- root.setHeight(100)
224
-
225
- const root_child0 = Yoga.Node.create(config)
226
- root_child0.setWidth(50)
227
- root_child0.setHeight(50)
228
- root.insertChild(root_child0, 0)
229
-
230
- const root_child1 = Yoga.Node.create(config)
231
- root_child1.setWidth(50)
232
- root_child1.setHeight(20)
233
- root.insertChild(root_child1, 1)
234
- root.calculateLayout(undefined, undefined, Direction.LTR)
235
-
236
- expect(root.getComputedLeft()).toBe(0)
237
- expect(root.getComputedTop()).toBe(0)
238
- expect(root.getComputedWidth()).toBe(100)
239
- expect(root.getComputedHeight()).toBe(100)
240
-
241
- expect(root_child0.getComputedLeft()).toBe(0)
242
- expect(root_child0.getComputedTop()).toBe(0)
243
- expect(root_child0.getComputedWidth()).toBe(50)
244
- expect(root_child0.getComputedHeight()).toBe(50)
245
-
246
- expect(root_child1.getComputedLeft()).toBe(50)
247
- expect(root_child1.getComputedTop()).toBe(30)
248
- expect(root_child1.getComputedWidth()).toBe(50)
249
- expect(root_child1.getComputedHeight()).toBe(20)
250
-
251
- root.calculateLayout(undefined, undefined, Direction.RTL)
252
-
253
- expect(root.getComputedLeft()).toBe(0)
254
- expect(root.getComputedTop()).toBe(0)
255
- expect(root.getComputedWidth()).toBe(100)
256
- expect(root.getComputedHeight()).toBe(100)
257
-
258
- expect(root_child0.getComputedLeft()).toBe(50)
259
- expect(root_child0.getComputedTop()).toBe(0)
260
- expect(root_child0.getComputedWidth()).toBe(50)
261
- expect(root_child0.getComputedHeight()).toBe(50)
262
-
263
- expect(root_child1.getComputedLeft()).toBe(0)
264
- expect(root_child1.getComputedTop()).toBe(30)
265
- expect(root_child1.getComputedWidth()).toBe(50)
266
- expect(root_child1.getComputedHeight()).toBe(20)
267
- } finally {
268
- if (typeof root !== "undefined") {
269
- root.freeRecursive()
270
- }
271
-
272
- config.free()
273
- }
274
- })
275
- test("align_baseline_child", () => {
276
- const config = Yoga.Config.create()
277
- let root
278
-
279
- try {
280
- root = Yoga.Node.create(config)
281
- root.setFlexDirection(FlexDirection.Row)
282
- root.setAlignItems(Align.Baseline)
283
- root.setPositionType(PositionType.Absolute)
284
- root.setWidth(100)
285
- root.setHeight(100)
286
-
287
- const root_child0 = Yoga.Node.create(config)
288
- root_child0.setWidth(50)
289
- root_child0.setHeight(50)
290
- root.insertChild(root_child0, 0)
291
-
292
- const root_child1 = Yoga.Node.create(config)
293
- root_child1.setWidth(50)
294
- root_child1.setHeight(20)
295
- root.insertChild(root_child1, 1)
296
-
297
- const root_child1_child0 = Yoga.Node.create(config)
298
- root_child1_child0.setWidth(50)
299
- root_child1_child0.setHeight(10)
300
- root_child1.insertChild(root_child1_child0, 0)
301
- root.calculateLayout(undefined, undefined, Direction.LTR)
302
-
303
- expect(root.getComputedLeft()).toBe(0)
304
- expect(root.getComputedTop()).toBe(0)
305
- expect(root.getComputedWidth()).toBe(100)
306
- expect(root.getComputedHeight()).toBe(100)
307
-
308
- expect(root_child0.getComputedLeft()).toBe(0)
309
- expect(root_child0.getComputedTop()).toBe(0)
310
- expect(root_child0.getComputedWidth()).toBe(50)
311
- expect(root_child0.getComputedHeight()).toBe(50)
312
-
313
- expect(root_child1.getComputedLeft()).toBe(50)
314
- expect(root_child1.getComputedTop()).toBe(40)
315
- expect(root_child1.getComputedWidth()).toBe(50)
316
- expect(root_child1.getComputedHeight()).toBe(20)
317
-
318
- expect(root_child1_child0.getComputedLeft()).toBe(0)
319
- expect(root_child1_child0.getComputedTop()).toBe(0)
320
- expect(root_child1_child0.getComputedWidth()).toBe(50)
321
- expect(root_child1_child0.getComputedHeight()).toBe(10)
322
-
323
- root.calculateLayout(undefined, undefined, Direction.RTL)
324
-
325
- expect(root.getComputedLeft()).toBe(0)
326
- expect(root.getComputedTop()).toBe(0)
327
- expect(root.getComputedWidth()).toBe(100)
328
- expect(root.getComputedHeight()).toBe(100)
329
-
330
- expect(root_child0.getComputedLeft()).toBe(50)
331
- expect(root_child0.getComputedTop()).toBe(0)
332
- expect(root_child0.getComputedWidth()).toBe(50)
333
- expect(root_child0.getComputedHeight()).toBe(50)
334
-
335
- expect(root_child1.getComputedLeft()).toBe(0)
336
- expect(root_child1.getComputedTop()).toBe(40)
337
- expect(root_child1.getComputedWidth()).toBe(50)
338
- expect(root_child1.getComputedHeight()).toBe(20)
339
-
340
- expect(root_child1_child0.getComputedLeft()).toBe(0)
341
- expect(root_child1_child0.getComputedTop()).toBe(0)
342
- expect(root_child1_child0.getComputedWidth()).toBe(50)
343
- expect(root_child1_child0.getComputedHeight()).toBe(10)
344
- } finally {
345
- if (typeof root !== "undefined") {
346
- root.freeRecursive()
347
- }
348
-
349
- config.free()
350
- }
351
- })
352
- test("align_baseline_child_multiline", () => {
353
- const config = Yoga.Config.create()
354
- let root
355
-
356
- try {
357
- root = Yoga.Node.create(config)
358
- root.setFlexDirection(FlexDirection.Row)
359
- root.setAlignItems(Align.Baseline)
360
- root.setPositionType(PositionType.Absolute)
361
- root.setWidth(100)
362
- root.setHeight(100)
363
-
364
- const root_child0 = Yoga.Node.create(config)
365
- root_child0.setWidth(50)
366
- root_child0.setHeight(60)
367
- root.insertChild(root_child0, 0)
368
-
369
- const root_child1 = Yoga.Node.create(config)
370
- root_child1.setFlexDirection(FlexDirection.Row)
371
- root_child1.setFlexWrap(Wrap.Wrap)
372
- root_child1.setWidth(50)
373
- root_child1.setHeight(25)
374
- root.insertChild(root_child1, 1)
375
-
376
- const root_child1_child0 = Yoga.Node.create(config)
377
- root_child1_child0.setWidth(25)
378
- root_child1_child0.setHeight(20)
379
- root_child1.insertChild(root_child1_child0, 0)
380
-
381
- const root_child1_child1 = Yoga.Node.create(config)
382
- root_child1_child1.setWidth(25)
383
- root_child1_child1.setHeight(10)
384
- root_child1.insertChild(root_child1_child1, 1)
385
-
386
- const root_child1_child2 = Yoga.Node.create(config)
387
- root_child1_child2.setWidth(25)
388
- root_child1_child2.setHeight(20)
389
- root_child1.insertChild(root_child1_child2, 2)
390
-
391
- const root_child1_child3 = Yoga.Node.create(config)
392
- root_child1_child3.setWidth(25)
393
- root_child1_child3.setHeight(10)
394
- root_child1.insertChild(root_child1_child3, 3)
395
- root.calculateLayout(undefined, undefined, Direction.LTR)
396
-
397
- expect(root.getComputedLeft()).toBe(0)
398
- expect(root.getComputedTop()).toBe(0)
399
- expect(root.getComputedWidth()).toBe(100)
400
- expect(root.getComputedHeight()).toBe(100)
401
-
402
- expect(root_child0.getComputedLeft()).toBe(0)
403
- expect(root_child0.getComputedTop()).toBe(0)
404
- expect(root_child0.getComputedWidth()).toBe(50)
405
- expect(root_child0.getComputedHeight()).toBe(60)
406
-
407
- expect(root_child1.getComputedLeft()).toBe(50)
408
- expect(root_child1.getComputedTop()).toBe(40)
409
- expect(root_child1.getComputedWidth()).toBe(50)
410
- expect(root_child1.getComputedHeight()).toBe(25)
411
-
412
- expect(root_child1_child0.getComputedLeft()).toBe(0)
413
- expect(root_child1_child0.getComputedTop()).toBe(0)
414
- expect(root_child1_child0.getComputedWidth()).toBe(25)
415
- expect(root_child1_child0.getComputedHeight()).toBe(20)
416
-
417
- expect(root_child1_child1.getComputedLeft()).toBe(25)
418
- expect(root_child1_child1.getComputedTop()).toBe(0)
419
- expect(root_child1_child1.getComputedWidth()).toBe(25)
420
- expect(root_child1_child1.getComputedHeight()).toBe(10)
421
-
422
- expect(root_child1_child2.getComputedLeft()).toBe(0)
423
- expect(root_child1_child2.getComputedTop()).toBe(20)
424
- expect(root_child1_child2.getComputedWidth()).toBe(25)
425
- expect(root_child1_child2.getComputedHeight()).toBe(20)
426
-
427
- expect(root_child1_child3.getComputedLeft()).toBe(25)
428
- expect(root_child1_child3.getComputedTop()).toBe(20)
429
- expect(root_child1_child3.getComputedWidth()).toBe(25)
430
- expect(root_child1_child3.getComputedHeight()).toBe(10)
431
-
432
- root.calculateLayout(undefined, undefined, Direction.RTL)
433
-
434
- expect(root.getComputedLeft()).toBe(0)
435
- expect(root.getComputedTop()).toBe(0)
436
- expect(root.getComputedWidth()).toBe(100)
437
- expect(root.getComputedHeight()).toBe(100)
438
-
439
- expect(root_child0.getComputedLeft()).toBe(50)
440
- expect(root_child0.getComputedTop()).toBe(0)
441
- expect(root_child0.getComputedWidth()).toBe(50)
442
- expect(root_child0.getComputedHeight()).toBe(60)
443
-
444
- expect(root_child1.getComputedLeft()).toBe(0)
445
- expect(root_child1.getComputedTop()).toBe(40)
446
- expect(root_child1.getComputedWidth()).toBe(50)
447
- expect(root_child1.getComputedHeight()).toBe(25)
448
-
449
- expect(root_child1_child0.getComputedLeft()).toBe(25)
450
- expect(root_child1_child0.getComputedTop()).toBe(0)
451
- expect(root_child1_child0.getComputedWidth()).toBe(25)
452
- expect(root_child1_child0.getComputedHeight()).toBe(20)
453
-
454
- expect(root_child1_child1.getComputedLeft()).toBe(0)
455
- expect(root_child1_child1.getComputedTop()).toBe(0)
456
- expect(root_child1_child1.getComputedWidth()).toBe(25)
457
- expect(root_child1_child1.getComputedHeight()).toBe(10)
458
-
459
- expect(root_child1_child2.getComputedLeft()).toBe(25)
460
- expect(root_child1_child2.getComputedTop()).toBe(20)
461
- expect(root_child1_child2.getComputedWidth()).toBe(25)
462
- expect(root_child1_child2.getComputedHeight()).toBe(20)
463
-
464
- expect(root_child1_child3.getComputedLeft()).toBe(0)
465
- expect(root_child1_child3.getComputedTop()).toBe(20)
466
- expect(root_child1_child3.getComputedWidth()).toBe(25)
467
- expect(root_child1_child3.getComputedHeight()).toBe(10)
468
- } finally {
469
- if (typeof root !== "undefined") {
470
- root.freeRecursive()
471
- }
472
-
473
- config.free()
474
- }
475
- })
476
- test("align_baseline_child_multiline_override", () => {
477
- const config = Yoga.Config.create()
478
- let root
479
-
480
- try {
481
- root = Yoga.Node.create(config)
482
- root.setFlexDirection(FlexDirection.Row)
483
- root.setAlignItems(Align.Baseline)
484
- root.setPositionType(PositionType.Absolute)
485
- root.setWidth(100)
486
- root.setHeight(100)
487
-
488
- const root_child0 = Yoga.Node.create(config)
489
- root_child0.setWidth(50)
490
- root_child0.setHeight(60)
491
- root.insertChild(root_child0, 0)
492
-
493
- const root_child1 = Yoga.Node.create(config)
494
- root_child1.setFlexDirection(FlexDirection.Row)
495
- root_child1.setFlexWrap(Wrap.Wrap)
496
- root_child1.setWidth(50)
497
- root_child1.setHeight(25)
498
- root.insertChild(root_child1, 1)
499
-
500
- const root_child1_child0 = Yoga.Node.create(config)
501
- root_child1_child0.setWidth(25)
502
- root_child1_child0.setHeight(20)
503
- root_child1.insertChild(root_child1_child0, 0)
504
-
505
- const root_child1_child1 = Yoga.Node.create(config)
506
- root_child1_child1.setAlignSelf(Align.Baseline)
507
- root_child1_child1.setWidth(25)
508
- root_child1_child1.setHeight(10)
509
- root_child1.insertChild(root_child1_child1, 1)
510
-
511
- const root_child1_child2 = Yoga.Node.create(config)
512
- root_child1_child2.setWidth(25)
513
- root_child1_child2.setHeight(20)
514
- root_child1.insertChild(root_child1_child2, 2)
515
-
516
- const root_child1_child3 = Yoga.Node.create(config)
517
- root_child1_child3.setAlignSelf(Align.Baseline)
518
- root_child1_child3.setWidth(25)
519
- root_child1_child3.setHeight(10)
520
- root_child1.insertChild(root_child1_child3, 3)
521
- root.calculateLayout(undefined, undefined, Direction.LTR)
522
-
523
- expect(root.getComputedLeft()).toBe(0)
524
- expect(root.getComputedTop()).toBe(0)
525
- expect(root.getComputedWidth()).toBe(100)
526
- expect(root.getComputedHeight()).toBe(100)
527
-
528
- expect(root_child0.getComputedLeft()).toBe(0)
529
- expect(root_child0.getComputedTop()).toBe(0)
530
- expect(root_child0.getComputedWidth()).toBe(50)
531
- expect(root_child0.getComputedHeight()).toBe(60)
532
-
533
- expect(root_child1.getComputedLeft()).toBe(50)
534
- expect(root_child1.getComputedTop()).toBe(50)
535
- expect(root_child1.getComputedWidth()).toBe(50)
536
- expect(root_child1.getComputedHeight()).toBe(25)
537
-
538
- expect(root_child1_child0.getComputedLeft()).toBe(0)
539
- expect(root_child1_child0.getComputedTop()).toBe(0)
540
- expect(root_child1_child0.getComputedWidth()).toBe(25)
541
- expect(root_child1_child0.getComputedHeight()).toBe(20)
542
-
543
- expect(root_child1_child1.getComputedLeft()).toBe(25)
544
- expect(root_child1_child1.getComputedTop()).toBe(0)
545
- expect(root_child1_child1.getComputedWidth()).toBe(25)
546
- expect(root_child1_child1.getComputedHeight()).toBe(10)
547
-
548
- expect(root_child1_child2.getComputedLeft()).toBe(0)
549
- expect(root_child1_child2.getComputedTop()).toBe(20)
550
- expect(root_child1_child2.getComputedWidth()).toBe(25)
551
- expect(root_child1_child2.getComputedHeight()).toBe(20)
552
-
553
- expect(root_child1_child3.getComputedLeft()).toBe(25)
554
- expect(root_child1_child3.getComputedTop()).toBe(20)
555
- expect(root_child1_child3.getComputedWidth()).toBe(25)
556
- expect(root_child1_child3.getComputedHeight()).toBe(10)
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(100)
563
- expect(root.getComputedHeight()).toBe(100)
564
-
565
- expect(root_child0.getComputedLeft()).toBe(50)
566
- expect(root_child0.getComputedTop()).toBe(0)
567
- expect(root_child0.getComputedWidth()).toBe(50)
568
- expect(root_child0.getComputedHeight()).toBe(60)
569
-
570
- expect(root_child1.getComputedLeft()).toBe(0)
571
- expect(root_child1.getComputedTop()).toBe(50)
572
- expect(root_child1.getComputedWidth()).toBe(50)
573
- expect(root_child1.getComputedHeight()).toBe(25)
574
-
575
- expect(root_child1_child0.getComputedLeft()).toBe(25)
576
- expect(root_child1_child0.getComputedTop()).toBe(0)
577
- expect(root_child1_child0.getComputedWidth()).toBe(25)
578
- expect(root_child1_child0.getComputedHeight()).toBe(20)
579
-
580
- expect(root_child1_child1.getComputedLeft()).toBe(0)
581
- expect(root_child1_child1.getComputedTop()).toBe(0)
582
- expect(root_child1_child1.getComputedWidth()).toBe(25)
583
- expect(root_child1_child1.getComputedHeight()).toBe(10)
584
-
585
- expect(root_child1_child2.getComputedLeft()).toBe(25)
586
- expect(root_child1_child2.getComputedTop()).toBe(20)
587
- expect(root_child1_child2.getComputedWidth()).toBe(25)
588
- expect(root_child1_child2.getComputedHeight()).toBe(20)
589
-
590
- expect(root_child1_child3.getComputedLeft()).toBe(0)
591
- expect(root_child1_child3.getComputedTop()).toBe(20)
592
- expect(root_child1_child3.getComputedWidth()).toBe(25)
593
- expect(root_child1_child3.getComputedHeight()).toBe(10)
594
- } finally {
595
- if (typeof root !== "undefined") {
596
- root.freeRecursive()
597
- }
598
-
599
- config.free()
600
- }
601
- })
602
- test("align_baseline_child_multiline_no_override_on_secondline", () => {
603
- const config = Yoga.Config.create()
604
- let root
605
-
606
- try {
607
- root = Yoga.Node.create(config)
608
- root.setFlexDirection(FlexDirection.Row)
609
- root.setAlignItems(Align.Baseline)
610
- root.setPositionType(PositionType.Absolute)
611
- root.setWidth(100)
612
- root.setHeight(100)
613
-
614
- const root_child0 = Yoga.Node.create(config)
615
- root_child0.setWidth(50)
616
- root_child0.setHeight(60)
617
- root.insertChild(root_child0, 0)
618
-
619
- const root_child1 = Yoga.Node.create(config)
620
- root_child1.setFlexDirection(FlexDirection.Row)
621
- root_child1.setFlexWrap(Wrap.Wrap)
622
- root_child1.setWidth(50)
623
- root_child1.setHeight(25)
624
- root.insertChild(root_child1, 1)
625
-
626
- const root_child1_child0 = Yoga.Node.create(config)
627
- root_child1_child0.setWidth(25)
628
- root_child1_child0.setHeight(20)
629
- root_child1.insertChild(root_child1_child0, 0)
630
-
631
- const root_child1_child1 = Yoga.Node.create(config)
632
- root_child1_child1.setWidth(25)
633
- root_child1_child1.setHeight(10)
634
- root_child1.insertChild(root_child1_child1, 1)
635
-
636
- const root_child1_child2 = Yoga.Node.create(config)
637
- root_child1_child2.setWidth(25)
638
- root_child1_child2.setHeight(20)
639
- root_child1.insertChild(root_child1_child2, 2)
640
-
641
- const root_child1_child3 = Yoga.Node.create(config)
642
- root_child1_child3.setAlignSelf(Align.Baseline)
643
- root_child1_child3.setWidth(25)
644
- root_child1_child3.setHeight(10)
645
- root_child1.insertChild(root_child1_child3, 3)
646
- root.calculateLayout(undefined, undefined, Direction.LTR)
647
-
648
- expect(root.getComputedLeft()).toBe(0)
649
- expect(root.getComputedTop()).toBe(0)
650
- expect(root.getComputedWidth()).toBe(100)
651
- expect(root.getComputedHeight()).toBe(100)
652
-
653
- expect(root_child0.getComputedLeft()).toBe(0)
654
- expect(root_child0.getComputedTop()).toBe(0)
655
- expect(root_child0.getComputedWidth()).toBe(50)
656
- expect(root_child0.getComputedHeight()).toBe(60)
657
-
658
- expect(root_child1.getComputedLeft()).toBe(50)
659
- expect(root_child1.getComputedTop()).toBe(40)
660
- expect(root_child1.getComputedWidth()).toBe(50)
661
- expect(root_child1.getComputedHeight()).toBe(25)
662
-
663
- expect(root_child1_child0.getComputedLeft()).toBe(0)
664
- expect(root_child1_child0.getComputedTop()).toBe(0)
665
- expect(root_child1_child0.getComputedWidth()).toBe(25)
666
- expect(root_child1_child0.getComputedHeight()).toBe(20)
667
-
668
- expect(root_child1_child1.getComputedLeft()).toBe(25)
669
- expect(root_child1_child1.getComputedTop()).toBe(0)
670
- expect(root_child1_child1.getComputedWidth()).toBe(25)
671
- expect(root_child1_child1.getComputedHeight()).toBe(10)
672
-
673
- expect(root_child1_child2.getComputedLeft()).toBe(0)
674
- expect(root_child1_child2.getComputedTop()).toBe(20)
675
- expect(root_child1_child2.getComputedWidth()).toBe(25)
676
- expect(root_child1_child2.getComputedHeight()).toBe(20)
677
-
678
- expect(root_child1_child3.getComputedLeft()).toBe(25)
679
- expect(root_child1_child3.getComputedTop()).toBe(20)
680
- expect(root_child1_child3.getComputedWidth()).toBe(25)
681
- expect(root_child1_child3.getComputedHeight()).toBe(10)
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(100)
688
- expect(root.getComputedHeight()).toBe(100)
689
-
690
- expect(root_child0.getComputedLeft()).toBe(50)
691
- expect(root_child0.getComputedTop()).toBe(0)
692
- expect(root_child0.getComputedWidth()).toBe(50)
693
- expect(root_child0.getComputedHeight()).toBe(60)
694
-
695
- expect(root_child1.getComputedLeft()).toBe(0)
696
- expect(root_child1.getComputedTop()).toBe(40)
697
- expect(root_child1.getComputedWidth()).toBe(50)
698
- expect(root_child1.getComputedHeight()).toBe(25)
699
-
700
- expect(root_child1_child0.getComputedLeft()).toBe(25)
701
- expect(root_child1_child0.getComputedTop()).toBe(0)
702
- expect(root_child1_child0.getComputedWidth()).toBe(25)
703
- expect(root_child1_child0.getComputedHeight()).toBe(20)
704
-
705
- expect(root_child1_child1.getComputedLeft()).toBe(0)
706
- expect(root_child1_child1.getComputedTop()).toBe(0)
707
- expect(root_child1_child1.getComputedWidth()).toBe(25)
708
- expect(root_child1_child1.getComputedHeight()).toBe(10)
709
-
710
- expect(root_child1_child2.getComputedLeft()).toBe(25)
711
- expect(root_child1_child2.getComputedTop()).toBe(20)
712
- expect(root_child1_child2.getComputedWidth()).toBe(25)
713
- expect(root_child1_child2.getComputedHeight()).toBe(20)
714
-
715
- expect(root_child1_child3.getComputedLeft()).toBe(0)
716
- expect(root_child1_child3.getComputedTop()).toBe(20)
717
- expect(root_child1_child3.getComputedWidth()).toBe(25)
718
- expect(root_child1_child3.getComputedHeight()).toBe(10)
719
- } finally {
720
- if (typeof root !== "undefined") {
721
- root.freeRecursive()
722
- }
723
-
724
- config.free()
725
- }
726
- })
727
- test("align_baseline_child_top", () => {
728
- const config = Yoga.Config.create()
729
- let root
730
-
731
- try {
732
- root = Yoga.Node.create(config)
733
- root.setFlexDirection(FlexDirection.Row)
734
- root.setAlignItems(Align.Baseline)
735
- root.setPositionType(PositionType.Absolute)
736
- root.setWidth(100)
737
- root.setHeight(100)
738
-
739
- const root_child0 = Yoga.Node.create(config)
740
- root_child0.setPosition(Edge.Top, 10)
741
- root_child0.setWidth(50)
742
- root_child0.setHeight(50)
743
- root.insertChild(root_child0, 0)
744
-
745
- const root_child1 = Yoga.Node.create(config)
746
- root_child1.setWidth(50)
747
- root_child1.setHeight(20)
748
- root.insertChild(root_child1, 1)
749
-
750
- const root_child1_child0 = Yoga.Node.create(config)
751
- root_child1_child0.setWidth(50)
752
- root_child1_child0.setHeight(10)
753
- root_child1.insertChild(root_child1_child0, 0)
754
- root.calculateLayout(undefined, undefined, Direction.LTR)
755
-
756
- expect(root.getComputedLeft()).toBe(0)
757
- expect(root.getComputedTop()).toBe(0)
758
- expect(root.getComputedWidth()).toBe(100)
759
- expect(root.getComputedHeight()).toBe(100)
760
-
761
- expect(root_child0.getComputedLeft()).toBe(0)
762
- expect(root_child0.getComputedTop()).toBe(10)
763
- expect(root_child0.getComputedWidth()).toBe(50)
764
- expect(root_child0.getComputedHeight()).toBe(50)
765
-
766
- expect(root_child1.getComputedLeft()).toBe(50)
767
- expect(root_child1.getComputedTop()).toBe(40)
768
- expect(root_child1.getComputedWidth()).toBe(50)
769
- expect(root_child1.getComputedHeight()).toBe(20)
770
-
771
- expect(root_child1_child0.getComputedLeft()).toBe(0)
772
- expect(root_child1_child0.getComputedTop()).toBe(0)
773
- expect(root_child1_child0.getComputedWidth()).toBe(50)
774
- expect(root_child1_child0.getComputedHeight()).toBe(10)
775
-
776
- root.calculateLayout(undefined, undefined, Direction.RTL)
777
-
778
- expect(root.getComputedLeft()).toBe(0)
779
- expect(root.getComputedTop()).toBe(0)
780
- expect(root.getComputedWidth()).toBe(100)
781
- expect(root.getComputedHeight()).toBe(100)
782
-
783
- expect(root_child0.getComputedLeft()).toBe(50)
784
- expect(root_child0.getComputedTop()).toBe(10)
785
- expect(root_child0.getComputedWidth()).toBe(50)
786
- expect(root_child0.getComputedHeight()).toBe(50)
787
-
788
- expect(root_child1.getComputedLeft()).toBe(0)
789
- expect(root_child1.getComputedTop()).toBe(40)
790
- expect(root_child1.getComputedWidth()).toBe(50)
791
- expect(root_child1.getComputedHeight()).toBe(20)
792
-
793
- expect(root_child1_child0.getComputedLeft()).toBe(0)
794
- expect(root_child1_child0.getComputedTop()).toBe(0)
795
- expect(root_child1_child0.getComputedWidth()).toBe(50)
796
- expect(root_child1_child0.getComputedHeight()).toBe(10)
797
- } finally {
798
- if (typeof root !== "undefined") {
799
- root.freeRecursive()
800
- }
801
-
802
- config.free()
803
- }
804
- })
805
- test("align_baseline_child_top2", () => {
806
- const config = Yoga.Config.create()
807
- let root
808
-
809
- try {
810
- root = Yoga.Node.create(config)
811
- root.setFlexDirection(FlexDirection.Row)
812
- root.setAlignItems(Align.Baseline)
813
- root.setPositionType(PositionType.Absolute)
814
- root.setWidth(100)
815
- root.setHeight(100)
816
-
817
- const root_child0 = Yoga.Node.create(config)
818
- root_child0.setWidth(50)
819
- root_child0.setHeight(50)
820
- root.insertChild(root_child0, 0)
821
-
822
- const root_child1 = Yoga.Node.create(config)
823
- root_child1.setPosition(Edge.Top, 5)
824
- root_child1.setWidth(50)
825
- root_child1.setHeight(20)
826
- root.insertChild(root_child1, 1)
827
-
828
- const root_child1_child0 = Yoga.Node.create(config)
829
- root_child1_child0.setWidth(50)
830
- root_child1_child0.setHeight(10)
831
- root_child1.insertChild(root_child1_child0, 0)
832
- root.calculateLayout(undefined, undefined, Direction.LTR)
833
-
834
- expect(root.getComputedLeft()).toBe(0)
835
- expect(root.getComputedTop()).toBe(0)
836
- expect(root.getComputedWidth()).toBe(100)
837
- expect(root.getComputedHeight()).toBe(100)
838
-
839
- expect(root_child0.getComputedLeft()).toBe(0)
840
- expect(root_child0.getComputedTop()).toBe(0)
841
- expect(root_child0.getComputedWidth()).toBe(50)
842
- expect(root_child0.getComputedHeight()).toBe(50)
843
-
844
- expect(root_child1.getComputedLeft()).toBe(50)
845
- expect(root_child1.getComputedTop()).toBe(45)
846
- expect(root_child1.getComputedWidth()).toBe(50)
847
- expect(root_child1.getComputedHeight()).toBe(20)
848
-
849
- expect(root_child1_child0.getComputedLeft()).toBe(0)
850
- expect(root_child1_child0.getComputedTop()).toBe(0)
851
- expect(root_child1_child0.getComputedWidth()).toBe(50)
852
- expect(root_child1_child0.getComputedHeight()).toBe(10)
853
-
854
- root.calculateLayout(undefined, undefined, Direction.RTL)
855
-
856
- expect(root.getComputedLeft()).toBe(0)
857
- expect(root.getComputedTop()).toBe(0)
858
- expect(root.getComputedWidth()).toBe(100)
859
- expect(root.getComputedHeight()).toBe(100)
860
-
861
- expect(root_child0.getComputedLeft()).toBe(50)
862
- expect(root_child0.getComputedTop()).toBe(0)
863
- expect(root_child0.getComputedWidth()).toBe(50)
864
- expect(root_child0.getComputedHeight()).toBe(50)
865
-
866
- expect(root_child1.getComputedLeft()).toBe(0)
867
- expect(root_child1.getComputedTop()).toBe(45)
868
- expect(root_child1.getComputedWidth()).toBe(50)
869
- expect(root_child1.getComputedHeight()).toBe(20)
870
-
871
- expect(root_child1_child0.getComputedLeft()).toBe(0)
872
- expect(root_child1_child0.getComputedTop()).toBe(0)
873
- expect(root_child1_child0.getComputedWidth()).toBe(50)
874
- expect(root_child1_child0.getComputedHeight()).toBe(10)
875
- } finally {
876
- if (typeof root !== "undefined") {
877
- root.freeRecursive()
878
- }
879
-
880
- config.free()
881
- }
882
- })
883
- test("align_baseline_double_nested_child", () => {
884
- const config = Yoga.Config.create()
885
- let root
886
-
887
- try {
888
- root = Yoga.Node.create(config)
889
- root.setFlexDirection(FlexDirection.Row)
890
- root.setAlignItems(Align.Baseline)
891
- root.setPositionType(PositionType.Absolute)
892
- root.setWidth(100)
893
- root.setHeight(100)
894
-
895
- const root_child0 = Yoga.Node.create(config)
896
- root_child0.setWidth(50)
897
- root_child0.setHeight(50)
898
- root.insertChild(root_child0, 0)
899
-
900
- const root_child0_child0 = Yoga.Node.create(config)
901
- root_child0_child0.setWidth(50)
902
- root_child0_child0.setHeight(20)
903
- root_child0.insertChild(root_child0_child0, 0)
904
-
905
- const root_child1 = Yoga.Node.create(config)
906
- root_child1.setWidth(50)
907
- root_child1.setHeight(20)
908
- root.insertChild(root_child1, 1)
909
-
910
- const root_child1_child0 = Yoga.Node.create(config)
911
- root_child1_child0.setWidth(50)
912
- root_child1_child0.setHeight(15)
913
- root_child1.insertChild(root_child1_child0, 0)
914
- root.calculateLayout(undefined, undefined, Direction.LTR)
915
-
916
- expect(root.getComputedLeft()).toBe(0)
917
- expect(root.getComputedTop()).toBe(0)
918
- expect(root.getComputedWidth()).toBe(100)
919
- expect(root.getComputedHeight()).toBe(100)
920
-
921
- expect(root_child0.getComputedLeft()).toBe(0)
922
- expect(root_child0.getComputedTop()).toBe(0)
923
- expect(root_child0.getComputedWidth()).toBe(50)
924
- expect(root_child0.getComputedHeight()).toBe(50)
925
-
926
- expect(root_child0_child0.getComputedLeft()).toBe(0)
927
- expect(root_child0_child0.getComputedTop()).toBe(0)
928
- expect(root_child0_child0.getComputedWidth()).toBe(50)
929
- expect(root_child0_child0.getComputedHeight()).toBe(20)
930
-
931
- expect(root_child1.getComputedLeft()).toBe(50)
932
- expect(root_child1.getComputedTop()).toBe(5)
933
- expect(root_child1.getComputedWidth()).toBe(50)
934
- expect(root_child1.getComputedHeight()).toBe(20)
935
-
936
- expect(root_child1_child0.getComputedLeft()).toBe(0)
937
- expect(root_child1_child0.getComputedTop()).toBe(0)
938
- expect(root_child1_child0.getComputedWidth()).toBe(50)
939
- expect(root_child1_child0.getComputedHeight()).toBe(15)
940
-
941
- root.calculateLayout(undefined, undefined, Direction.RTL)
942
-
943
- expect(root.getComputedLeft()).toBe(0)
944
- expect(root.getComputedTop()).toBe(0)
945
- expect(root.getComputedWidth()).toBe(100)
946
- expect(root.getComputedHeight()).toBe(100)
947
-
948
- expect(root_child0.getComputedLeft()).toBe(50)
949
- expect(root_child0.getComputedTop()).toBe(0)
950
- expect(root_child0.getComputedWidth()).toBe(50)
951
- expect(root_child0.getComputedHeight()).toBe(50)
952
-
953
- expect(root_child0_child0.getComputedLeft()).toBe(0)
954
- expect(root_child0_child0.getComputedTop()).toBe(0)
955
- expect(root_child0_child0.getComputedWidth()).toBe(50)
956
- expect(root_child0_child0.getComputedHeight()).toBe(20)
957
-
958
- expect(root_child1.getComputedLeft()).toBe(0)
959
- expect(root_child1.getComputedTop()).toBe(5)
960
- expect(root_child1.getComputedWidth()).toBe(50)
961
- expect(root_child1.getComputedHeight()).toBe(20)
962
-
963
- expect(root_child1_child0.getComputedLeft()).toBe(0)
964
- expect(root_child1_child0.getComputedTop()).toBe(0)
965
- expect(root_child1_child0.getComputedWidth()).toBe(50)
966
- expect(root_child1_child0.getComputedHeight()).toBe(15)
967
- } finally {
968
- if (typeof root !== "undefined") {
969
- root.freeRecursive()
970
- }
971
-
972
- config.free()
973
- }
974
- })
975
- test("align_baseline_column", () => {
976
- const config = Yoga.Config.create()
977
- let root
978
-
979
- try {
980
- root = Yoga.Node.create(config)
981
- root.setAlignItems(Align.Baseline)
982
- root.setPositionType(PositionType.Absolute)
983
- root.setWidth(100)
984
- root.setHeight(100)
985
-
986
- const root_child0 = Yoga.Node.create(config)
987
- root_child0.setWidth(50)
988
- root_child0.setHeight(50)
989
- root.insertChild(root_child0, 0)
990
-
991
- const root_child1 = Yoga.Node.create(config)
992
- root_child1.setWidth(50)
993
- root_child1.setHeight(20)
994
- root.insertChild(root_child1, 1)
995
- root.calculateLayout(undefined, undefined, Direction.LTR)
996
-
997
- expect(root.getComputedLeft()).toBe(0)
998
- expect(root.getComputedTop()).toBe(0)
999
- expect(root.getComputedWidth()).toBe(100)
1000
- expect(root.getComputedHeight()).toBe(100)
1001
-
1002
- expect(root_child0.getComputedLeft()).toBe(0)
1003
- expect(root_child0.getComputedTop()).toBe(0)
1004
- expect(root_child0.getComputedWidth()).toBe(50)
1005
- expect(root_child0.getComputedHeight()).toBe(50)
1006
-
1007
- expect(root_child1.getComputedLeft()).toBe(0)
1008
- expect(root_child1.getComputedTop()).toBe(50)
1009
- expect(root_child1.getComputedWidth()).toBe(50)
1010
- expect(root_child1.getComputedHeight()).toBe(20)
1011
-
1012
- root.calculateLayout(undefined, undefined, Direction.RTL)
1013
-
1014
- expect(root.getComputedLeft()).toBe(0)
1015
- expect(root.getComputedTop()).toBe(0)
1016
- expect(root.getComputedWidth()).toBe(100)
1017
- expect(root.getComputedHeight()).toBe(100)
1018
-
1019
- expect(root_child0.getComputedLeft()).toBe(50)
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(50)
1025
- expect(root_child1.getComputedTop()).toBe(50)
1026
- expect(root_child1.getComputedWidth()).toBe(50)
1027
- expect(root_child1.getComputedHeight()).toBe(20)
1028
- } finally {
1029
- if (typeof root !== "undefined") {
1030
- root.freeRecursive()
1031
- }
1032
-
1033
- config.free()
1034
- }
1035
- })
1036
- test("align_baseline_child_margin", () => {
1037
- const config = Yoga.Config.create()
1038
- let root
1039
-
1040
- try {
1041
- root = Yoga.Node.create(config)
1042
- root.setFlexDirection(FlexDirection.Row)
1043
- root.setAlignItems(Align.Baseline)
1044
- root.setPositionType(PositionType.Absolute)
1045
- root.setWidth(100)
1046
- root.setHeight(100)
1047
-
1048
- const root_child0 = Yoga.Node.create(config)
1049
- root_child0.setMargin(Edge.Left, 5)
1050
- root_child0.setMargin(Edge.Top, 5)
1051
- root_child0.setMargin(Edge.Right, 5)
1052
- root_child0.setMargin(Edge.Bottom, 5)
1053
- root_child0.setWidth(50)
1054
- root_child0.setHeight(50)
1055
- root.insertChild(root_child0, 0)
1056
-
1057
- const root_child1 = Yoga.Node.create(config)
1058
- root_child1.setWidth(50)
1059
- root_child1.setHeight(20)
1060
- root.insertChild(root_child1, 1)
1061
-
1062
- const root_child1_child0 = Yoga.Node.create(config)
1063
- root_child1_child0.setMargin(Edge.Left, 1)
1064
- root_child1_child0.setMargin(Edge.Top, 1)
1065
- root_child1_child0.setMargin(Edge.Right, 1)
1066
- root_child1_child0.setMargin(Edge.Bottom, 1)
1067
- root_child1_child0.setWidth(50)
1068
- root_child1_child0.setHeight(10)
1069
- root_child1.insertChild(root_child1_child0, 0)
1070
- root.calculateLayout(undefined, undefined, Direction.LTR)
1071
-
1072
- expect(root.getComputedLeft()).toBe(0)
1073
- expect(root.getComputedTop()).toBe(0)
1074
- expect(root.getComputedWidth()).toBe(100)
1075
- expect(root.getComputedHeight()).toBe(100)
1076
-
1077
- expect(root_child0.getComputedLeft()).toBe(5)
1078
- expect(root_child0.getComputedTop()).toBe(5)
1079
- expect(root_child0.getComputedWidth()).toBe(50)
1080
- expect(root_child0.getComputedHeight()).toBe(50)
1081
-
1082
- expect(root_child1.getComputedLeft()).toBe(60)
1083
- expect(root_child1.getComputedTop()).toBe(44)
1084
- expect(root_child1.getComputedWidth()).toBe(50)
1085
- expect(root_child1.getComputedHeight()).toBe(20)
1086
-
1087
- expect(root_child1_child0.getComputedLeft()).toBe(1)
1088
- expect(root_child1_child0.getComputedTop()).toBe(1)
1089
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1090
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1091
-
1092
- root.calculateLayout(undefined, undefined, Direction.RTL)
1093
-
1094
- expect(root.getComputedLeft()).toBe(0)
1095
- expect(root.getComputedTop()).toBe(0)
1096
- expect(root.getComputedWidth()).toBe(100)
1097
- expect(root.getComputedHeight()).toBe(100)
1098
-
1099
- expect(root_child0.getComputedLeft()).toBe(45)
1100
- expect(root_child0.getComputedTop()).toBe(5)
1101
- expect(root_child0.getComputedWidth()).toBe(50)
1102
- expect(root_child0.getComputedHeight()).toBe(50)
1103
-
1104
- expect(root_child1.getComputedLeft()).toBe(-10)
1105
- expect(root_child1.getComputedTop()).toBe(44)
1106
- expect(root_child1.getComputedWidth()).toBe(50)
1107
- expect(root_child1.getComputedHeight()).toBe(20)
1108
-
1109
- expect(root_child1_child0.getComputedLeft()).toBe(-1)
1110
- expect(root_child1_child0.getComputedTop()).toBe(1)
1111
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1112
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1113
- } finally {
1114
- if (typeof root !== "undefined") {
1115
- root.freeRecursive()
1116
- }
1117
-
1118
- config.free()
1119
- }
1120
- })
1121
- test("align_baseline_child_padding", () => {
1122
- const config = Yoga.Config.create()
1123
- let root
1124
-
1125
- try {
1126
- root = Yoga.Node.create(config)
1127
- root.setFlexDirection(FlexDirection.Row)
1128
- root.setAlignItems(Align.Baseline)
1129
- root.setPositionType(PositionType.Absolute)
1130
- root.setPadding(Edge.Left, 5)
1131
- root.setPadding(Edge.Top, 5)
1132
- root.setPadding(Edge.Right, 5)
1133
- root.setPadding(Edge.Bottom, 5)
1134
- root.setWidth(100)
1135
- root.setHeight(100)
1136
-
1137
- const root_child0 = Yoga.Node.create(config)
1138
- root_child0.setWidth(50)
1139
- root_child0.setHeight(50)
1140
- root.insertChild(root_child0, 0)
1141
-
1142
- const root_child1 = Yoga.Node.create(config)
1143
- root_child1.setPadding(Edge.Left, 5)
1144
- root_child1.setPadding(Edge.Top, 5)
1145
- root_child1.setPadding(Edge.Right, 5)
1146
- root_child1.setPadding(Edge.Bottom, 5)
1147
- root_child1.setWidth(50)
1148
- root_child1.setHeight(20)
1149
- root.insertChild(root_child1, 1)
1150
-
1151
- const root_child1_child0 = Yoga.Node.create(config)
1152
- root_child1_child0.setWidth(50)
1153
- root_child1_child0.setHeight(10)
1154
- root_child1.insertChild(root_child1_child0, 0)
1155
- root.calculateLayout(undefined, undefined, Direction.LTR)
1156
-
1157
- expect(root.getComputedLeft()).toBe(0)
1158
- expect(root.getComputedTop()).toBe(0)
1159
- expect(root.getComputedWidth()).toBe(100)
1160
- expect(root.getComputedHeight()).toBe(100)
1161
-
1162
- expect(root_child0.getComputedLeft()).toBe(5)
1163
- expect(root_child0.getComputedTop()).toBe(5)
1164
- expect(root_child0.getComputedWidth()).toBe(50)
1165
- expect(root_child0.getComputedHeight()).toBe(50)
1166
-
1167
- expect(root_child1.getComputedLeft()).toBe(55)
1168
- expect(root_child1.getComputedTop()).toBe(40)
1169
- expect(root_child1.getComputedWidth()).toBe(50)
1170
- expect(root_child1.getComputedHeight()).toBe(20)
1171
-
1172
- expect(root_child1_child0.getComputedLeft()).toBe(5)
1173
- expect(root_child1_child0.getComputedTop()).toBe(5)
1174
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1175
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1176
-
1177
- root.calculateLayout(undefined, undefined, Direction.RTL)
1178
-
1179
- expect(root.getComputedLeft()).toBe(0)
1180
- expect(root.getComputedTop()).toBe(0)
1181
- expect(root.getComputedWidth()).toBe(100)
1182
- expect(root.getComputedHeight()).toBe(100)
1183
-
1184
- expect(root_child0.getComputedLeft()).toBe(45)
1185
- expect(root_child0.getComputedTop()).toBe(5)
1186
- expect(root_child0.getComputedWidth()).toBe(50)
1187
- expect(root_child0.getComputedHeight()).toBe(50)
1188
-
1189
- expect(root_child1.getComputedLeft()).toBe(-5)
1190
- expect(root_child1.getComputedTop()).toBe(40)
1191
- expect(root_child1.getComputedWidth()).toBe(50)
1192
- expect(root_child1.getComputedHeight()).toBe(20)
1193
-
1194
- expect(root_child1_child0.getComputedLeft()).toBe(-5)
1195
- expect(root_child1_child0.getComputedTop()).toBe(5)
1196
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1197
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1198
- } finally {
1199
- if (typeof root !== "undefined") {
1200
- root.freeRecursive()
1201
- }
1202
-
1203
- config.free()
1204
- }
1205
- })
1206
- test("align_baseline_multiline", () => {
1207
- const config = Yoga.Config.create()
1208
- let root
1209
-
1210
- try {
1211
- root = Yoga.Node.create(config)
1212
- root.setFlexDirection(FlexDirection.Row)
1213
- root.setAlignItems(Align.Baseline)
1214
- root.setPositionType(PositionType.Absolute)
1215
- root.setFlexWrap(Wrap.Wrap)
1216
- root.setWidth(100)
1217
- root.setHeight(100)
1218
-
1219
- const root_child0 = Yoga.Node.create(config)
1220
- root_child0.setWidth(50)
1221
- root_child0.setHeight(50)
1222
- root.insertChild(root_child0, 0)
1223
-
1224
- const root_child1 = Yoga.Node.create(config)
1225
- root_child1.setWidth(50)
1226
- root_child1.setHeight(20)
1227
- root.insertChild(root_child1, 1)
1228
-
1229
- const root_child1_child0 = Yoga.Node.create(config)
1230
- root_child1_child0.setWidth(50)
1231
- root_child1_child0.setHeight(10)
1232
- root_child1.insertChild(root_child1_child0, 0)
1233
-
1234
- const root_child2 = Yoga.Node.create(config)
1235
- root_child2.setWidth(50)
1236
- root_child2.setHeight(20)
1237
- root.insertChild(root_child2, 2)
1238
-
1239
- const root_child2_child0 = Yoga.Node.create(config)
1240
- root_child2_child0.setWidth(50)
1241
- root_child2_child0.setHeight(10)
1242
- root_child2.insertChild(root_child2_child0, 0)
1243
-
1244
- const root_child3 = Yoga.Node.create(config)
1245
- root_child3.setWidth(50)
1246
- root_child3.setHeight(50)
1247
- root.insertChild(root_child3, 3)
1248
- root.calculateLayout(undefined, undefined, Direction.LTR)
1249
-
1250
- expect(root.getComputedLeft()).toBe(0)
1251
- expect(root.getComputedTop()).toBe(0)
1252
- expect(root.getComputedWidth()).toBe(100)
1253
- expect(root.getComputedHeight()).toBe(100)
1254
-
1255
- expect(root_child0.getComputedLeft()).toBe(0)
1256
- expect(root_child0.getComputedTop()).toBe(0)
1257
- expect(root_child0.getComputedWidth()).toBe(50)
1258
- expect(root_child0.getComputedHeight()).toBe(50)
1259
-
1260
- expect(root_child1.getComputedLeft()).toBe(50)
1261
- expect(root_child1.getComputedTop()).toBe(40)
1262
- expect(root_child1.getComputedWidth()).toBe(50)
1263
- expect(root_child1.getComputedHeight()).toBe(20)
1264
-
1265
- expect(root_child1_child0.getComputedLeft()).toBe(0)
1266
- expect(root_child1_child0.getComputedTop()).toBe(0)
1267
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1268
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1269
-
1270
- expect(root_child2.getComputedLeft()).toBe(0)
1271
- expect(root_child2.getComputedTop()).toBe(100)
1272
- expect(root_child2.getComputedWidth()).toBe(50)
1273
- expect(root_child2.getComputedHeight()).toBe(20)
1274
-
1275
- expect(root_child2_child0.getComputedLeft()).toBe(0)
1276
- expect(root_child2_child0.getComputedTop()).toBe(0)
1277
- expect(root_child2_child0.getComputedWidth()).toBe(50)
1278
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1279
-
1280
- expect(root_child3.getComputedLeft()).toBe(50)
1281
- expect(root_child3.getComputedTop()).toBe(60)
1282
- expect(root_child3.getComputedWidth()).toBe(50)
1283
- expect(root_child3.getComputedHeight()).toBe(50)
1284
-
1285
- root.calculateLayout(undefined, undefined, Direction.RTL)
1286
-
1287
- expect(root.getComputedLeft()).toBe(0)
1288
- expect(root.getComputedTop()).toBe(0)
1289
- expect(root.getComputedWidth()).toBe(100)
1290
- expect(root.getComputedHeight()).toBe(100)
1291
-
1292
- expect(root_child0.getComputedLeft()).toBe(50)
1293
- expect(root_child0.getComputedTop()).toBe(0)
1294
- expect(root_child0.getComputedWidth()).toBe(50)
1295
- expect(root_child0.getComputedHeight()).toBe(50)
1296
-
1297
- expect(root_child1.getComputedLeft()).toBe(0)
1298
- expect(root_child1.getComputedTop()).toBe(40)
1299
- expect(root_child1.getComputedWidth()).toBe(50)
1300
- expect(root_child1.getComputedHeight()).toBe(20)
1301
-
1302
- expect(root_child1_child0.getComputedLeft()).toBe(0)
1303
- expect(root_child1_child0.getComputedTop()).toBe(0)
1304
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1305
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1306
-
1307
- expect(root_child2.getComputedLeft()).toBe(50)
1308
- expect(root_child2.getComputedTop()).toBe(100)
1309
- expect(root_child2.getComputedWidth()).toBe(50)
1310
- expect(root_child2.getComputedHeight()).toBe(20)
1311
-
1312
- expect(root_child2_child0.getComputedLeft()).toBe(0)
1313
- expect(root_child2_child0.getComputedTop()).toBe(0)
1314
- expect(root_child2_child0.getComputedWidth()).toBe(50)
1315
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1316
-
1317
- expect(root_child3.getComputedLeft()).toBe(0)
1318
- expect(root_child3.getComputedTop()).toBe(60)
1319
- expect(root_child3.getComputedWidth()).toBe(50)
1320
- expect(root_child3.getComputedHeight()).toBe(50)
1321
- } finally {
1322
- if (typeof root !== "undefined") {
1323
- root.freeRecursive()
1324
- }
1325
-
1326
- config.free()
1327
- }
1328
- })
1329
- test.skip("align_baseline_multiline_column", () => {
1330
- const config = Yoga.Config.create()
1331
- let root
1332
-
1333
- try {
1334
- root = Yoga.Node.create(config)
1335
- root.setAlignItems(Align.Baseline)
1336
- root.setPositionType(PositionType.Absolute)
1337
- root.setFlexWrap(Wrap.Wrap)
1338
- root.setWidth(100)
1339
- root.setHeight(100)
1340
-
1341
- const root_child0 = Yoga.Node.create(config)
1342
- root_child0.setWidth(50)
1343
- root_child0.setHeight(50)
1344
- root.insertChild(root_child0, 0)
1345
-
1346
- const root_child1 = Yoga.Node.create(config)
1347
- root_child1.setWidth(30)
1348
- root_child1.setHeight(50)
1349
- root.insertChild(root_child1, 1)
1350
-
1351
- const root_child1_child0 = Yoga.Node.create(config)
1352
- root_child1_child0.setWidth(20)
1353
- root_child1_child0.setHeight(20)
1354
- root_child1.insertChild(root_child1_child0, 0)
1355
-
1356
- const root_child2 = Yoga.Node.create(config)
1357
- root_child2.setWidth(40)
1358
- root_child2.setHeight(70)
1359
- root.insertChild(root_child2, 2)
1360
-
1361
- const root_child2_child0 = Yoga.Node.create(config)
1362
- root_child2_child0.setWidth(10)
1363
- root_child2_child0.setHeight(10)
1364
- root_child2.insertChild(root_child2_child0, 0)
1365
-
1366
- const root_child3 = Yoga.Node.create(config)
1367
- root_child3.setWidth(50)
1368
- root_child3.setHeight(20)
1369
- root.insertChild(root_child3, 3)
1370
- root.calculateLayout(undefined, undefined, Direction.LTR)
1371
-
1372
- expect(root.getComputedLeft()).toBe(0)
1373
- expect(root.getComputedTop()).toBe(0)
1374
- expect(root.getComputedWidth()).toBe(100)
1375
- expect(root.getComputedHeight()).toBe(100)
1376
-
1377
- expect(root_child0.getComputedLeft()).toBe(0)
1378
- expect(root_child0.getComputedTop()).toBe(0)
1379
- expect(root_child0.getComputedWidth()).toBe(50)
1380
- expect(root_child0.getComputedHeight()).toBe(50)
1381
-
1382
- expect(root_child1.getComputedLeft()).toBe(0)
1383
- expect(root_child1.getComputedTop()).toBe(50)
1384
- expect(root_child1.getComputedWidth()).toBe(30)
1385
- expect(root_child1.getComputedHeight()).toBe(50)
1386
-
1387
- expect(root_child1_child0.getComputedLeft()).toBe(0)
1388
- expect(root_child1_child0.getComputedTop()).toBe(0)
1389
- expect(root_child1_child0.getComputedWidth()).toBe(20)
1390
- expect(root_child1_child0.getComputedHeight()).toBe(20)
1391
-
1392
- expect(root_child2.getComputedLeft()).toBe(50)
1393
- expect(root_child2.getComputedTop()).toBe(0)
1394
- expect(root_child2.getComputedWidth()).toBe(40)
1395
- expect(root_child2.getComputedHeight()).toBe(70)
1396
-
1397
- expect(root_child2_child0.getComputedLeft()).toBe(0)
1398
- expect(root_child2_child0.getComputedTop()).toBe(0)
1399
- expect(root_child2_child0.getComputedWidth()).toBe(10)
1400
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1401
-
1402
- expect(root_child3.getComputedLeft()).toBe(50)
1403
- expect(root_child3.getComputedTop()).toBe(70)
1404
- expect(root_child3.getComputedWidth()).toBe(50)
1405
- expect(root_child3.getComputedHeight()).toBe(20)
1406
-
1407
- root.calculateLayout(undefined, undefined, Direction.RTL)
1408
-
1409
- expect(root.getComputedLeft()).toBe(0)
1410
- expect(root.getComputedTop()).toBe(0)
1411
- expect(root.getComputedWidth()).toBe(100)
1412
- expect(root.getComputedHeight()).toBe(100)
1413
-
1414
- expect(root_child0.getComputedLeft()).toBe(50)
1415
- expect(root_child0.getComputedTop()).toBe(0)
1416
- expect(root_child0.getComputedWidth()).toBe(50)
1417
- expect(root_child0.getComputedHeight()).toBe(50)
1418
-
1419
- expect(root_child1.getComputedLeft()).toBe(50)
1420
- expect(root_child1.getComputedTop()).toBe(50)
1421
- expect(root_child1.getComputedWidth()).toBe(30)
1422
- expect(root_child1.getComputedHeight()).toBe(50)
1423
-
1424
- expect(root_child1_child0.getComputedLeft()).toBe(10)
1425
- expect(root_child1_child0.getComputedTop()).toBe(0)
1426
- expect(root_child1_child0.getComputedWidth()).toBe(20)
1427
- expect(root_child1_child0.getComputedHeight()).toBe(20)
1428
-
1429
- expect(root_child2.getComputedLeft()).toBe(0)
1430
- expect(root_child2.getComputedTop()).toBe(0)
1431
- expect(root_child2.getComputedWidth()).toBe(40)
1432
- expect(root_child2.getComputedHeight()).toBe(70)
1433
-
1434
- expect(root_child2_child0.getComputedLeft()).toBe(30)
1435
- expect(root_child2_child0.getComputedTop()).toBe(0)
1436
- expect(root_child2_child0.getComputedWidth()).toBe(10)
1437
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1438
-
1439
- expect(root_child3.getComputedLeft()).toBe(0)
1440
- expect(root_child3.getComputedTop()).toBe(70)
1441
- expect(root_child3.getComputedWidth()).toBe(50)
1442
- expect(root_child3.getComputedHeight()).toBe(20)
1443
- } finally {
1444
- if (typeof root !== "undefined") {
1445
- root.freeRecursive()
1446
- }
1447
-
1448
- config.free()
1449
- }
1450
- })
1451
- test.skip("align_baseline_multiline_column2", () => {
1452
- const config = Yoga.Config.create()
1453
- let root
1454
-
1455
- try {
1456
- root = Yoga.Node.create(config)
1457
- root.setAlignItems(Align.Baseline)
1458
- root.setPositionType(PositionType.Absolute)
1459
- root.setFlexWrap(Wrap.Wrap)
1460
- root.setWidth(100)
1461
- root.setHeight(100)
1462
-
1463
- const root_child0 = Yoga.Node.create(config)
1464
- root_child0.setWidth(50)
1465
- root_child0.setHeight(50)
1466
- root.insertChild(root_child0, 0)
1467
-
1468
- const root_child1 = Yoga.Node.create(config)
1469
- root_child1.setWidth(30)
1470
- root_child1.setHeight(50)
1471
- root.insertChild(root_child1, 1)
1472
-
1473
- const root_child1_child0 = Yoga.Node.create(config)
1474
- root_child1_child0.setWidth(20)
1475
- root_child1_child0.setHeight(20)
1476
- root_child1.insertChild(root_child1_child0, 0)
1477
-
1478
- const root_child2 = Yoga.Node.create(config)
1479
- root_child2.setWidth(40)
1480
- root_child2.setHeight(70)
1481
- root.insertChild(root_child2, 2)
1482
-
1483
- const root_child2_child0 = Yoga.Node.create(config)
1484
- root_child2_child0.setWidth(10)
1485
- root_child2_child0.setHeight(10)
1486
- root_child2.insertChild(root_child2_child0, 0)
1487
-
1488
- const root_child3 = Yoga.Node.create(config)
1489
- root_child3.setWidth(50)
1490
- root_child3.setHeight(20)
1491
- root.insertChild(root_child3, 3)
1492
- root.calculateLayout(undefined, undefined, Direction.LTR)
1493
-
1494
- expect(root.getComputedLeft()).toBe(0)
1495
- expect(root.getComputedTop()).toBe(0)
1496
- expect(root.getComputedWidth()).toBe(100)
1497
- expect(root.getComputedHeight()).toBe(100)
1498
-
1499
- expect(root_child0.getComputedLeft()).toBe(0)
1500
- expect(root_child0.getComputedTop()).toBe(0)
1501
- expect(root_child0.getComputedWidth()).toBe(50)
1502
- expect(root_child0.getComputedHeight()).toBe(50)
1503
-
1504
- expect(root_child1.getComputedLeft()).toBe(0)
1505
- expect(root_child1.getComputedTop()).toBe(50)
1506
- expect(root_child1.getComputedWidth()).toBe(30)
1507
- expect(root_child1.getComputedHeight()).toBe(50)
1508
-
1509
- expect(root_child1_child0.getComputedLeft()).toBe(0)
1510
- expect(root_child1_child0.getComputedTop()).toBe(0)
1511
- expect(root_child1_child0.getComputedWidth()).toBe(20)
1512
- expect(root_child1_child0.getComputedHeight()).toBe(20)
1513
-
1514
- expect(root_child2.getComputedLeft()).toBe(50)
1515
- expect(root_child2.getComputedTop()).toBe(0)
1516
- expect(root_child2.getComputedWidth()).toBe(40)
1517
- expect(root_child2.getComputedHeight()).toBe(70)
1518
-
1519
- expect(root_child2_child0.getComputedLeft()).toBe(0)
1520
- expect(root_child2_child0.getComputedTop()).toBe(0)
1521
- expect(root_child2_child0.getComputedWidth()).toBe(10)
1522
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1523
-
1524
- expect(root_child3.getComputedLeft()).toBe(50)
1525
- expect(root_child3.getComputedTop()).toBe(70)
1526
- expect(root_child3.getComputedWidth()).toBe(50)
1527
- expect(root_child3.getComputedHeight()).toBe(20)
1528
-
1529
- root.calculateLayout(undefined, undefined, Direction.RTL)
1530
-
1531
- expect(root.getComputedLeft()).toBe(0)
1532
- expect(root.getComputedTop()).toBe(0)
1533
- expect(root.getComputedWidth()).toBe(100)
1534
- expect(root.getComputedHeight()).toBe(100)
1535
-
1536
- expect(root_child0.getComputedLeft()).toBe(50)
1537
- expect(root_child0.getComputedTop()).toBe(0)
1538
- expect(root_child0.getComputedWidth()).toBe(50)
1539
- expect(root_child0.getComputedHeight()).toBe(50)
1540
-
1541
- expect(root_child1.getComputedLeft()).toBe(50)
1542
- expect(root_child1.getComputedTop()).toBe(50)
1543
- expect(root_child1.getComputedWidth()).toBe(30)
1544
- expect(root_child1.getComputedHeight()).toBe(50)
1545
-
1546
- expect(root_child1_child0.getComputedLeft()).toBe(10)
1547
- expect(root_child1_child0.getComputedTop()).toBe(0)
1548
- expect(root_child1_child0.getComputedWidth()).toBe(20)
1549
- expect(root_child1_child0.getComputedHeight()).toBe(20)
1550
-
1551
- expect(root_child2.getComputedLeft()).toBe(0)
1552
- expect(root_child2.getComputedTop()).toBe(0)
1553
- expect(root_child2.getComputedWidth()).toBe(40)
1554
- expect(root_child2.getComputedHeight()).toBe(70)
1555
-
1556
- expect(root_child2_child0.getComputedLeft()).toBe(30)
1557
- expect(root_child2_child0.getComputedTop()).toBe(0)
1558
- expect(root_child2_child0.getComputedWidth()).toBe(10)
1559
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1560
-
1561
- expect(root_child3.getComputedLeft()).toBe(0)
1562
- expect(root_child3.getComputedTop()).toBe(70)
1563
- expect(root_child3.getComputedWidth()).toBe(50)
1564
- expect(root_child3.getComputedHeight()).toBe(20)
1565
- } finally {
1566
- if (typeof root !== "undefined") {
1567
- root.freeRecursive()
1568
- }
1569
-
1570
- config.free()
1571
- }
1572
- })
1573
- test("align_baseline_multiline_row_and_column", () => {
1574
- const config = Yoga.Config.create()
1575
- let root
1576
-
1577
- try {
1578
- root = Yoga.Node.create(config)
1579
- root.setFlexDirection(FlexDirection.Row)
1580
- root.setAlignItems(Align.Baseline)
1581
- root.setPositionType(PositionType.Absolute)
1582
- root.setFlexWrap(Wrap.Wrap)
1583
- root.setWidth(100)
1584
- root.setHeight(100)
1585
-
1586
- const root_child0 = Yoga.Node.create(config)
1587
- root_child0.setWidth(50)
1588
- root_child0.setHeight(50)
1589
- root.insertChild(root_child0, 0)
1590
-
1591
- const root_child1 = Yoga.Node.create(config)
1592
- root_child1.setWidth(50)
1593
- root_child1.setHeight(50)
1594
- root.insertChild(root_child1, 1)
1595
-
1596
- const root_child1_child0 = Yoga.Node.create(config)
1597
- root_child1_child0.setWidth(50)
1598
- root_child1_child0.setHeight(10)
1599
- root_child1.insertChild(root_child1_child0, 0)
1600
-
1601
- const root_child2 = Yoga.Node.create(config)
1602
- root_child2.setWidth(50)
1603
- root_child2.setHeight(20)
1604
- root.insertChild(root_child2, 2)
1605
-
1606
- const root_child2_child0 = Yoga.Node.create(config)
1607
- root_child2_child0.setWidth(50)
1608
- root_child2_child0.setHeight(10)
1609
- root_child2.insertChild(root_child2_child0, 0)
1610
-
1611
- const root_child3 = Yoga.Node.create(config)
1612
- root_child3.setWidth(50)
1613
- root_child3.setHeight(20)
1614
- root.insertChild(root_child3, 3)
1615
- root.calculateLayout(undefined, undefined, Direction.LTR)
1616
-
1617
- expect(root.getComputedLeft()).toBe(0)
1618
- expect(root.getComputedTop()).toBe(0)
1619
- expect(root.getComputedWidth()).toBe(100)
1620
- expect(root.getComputedHeight()).toBe(100)
1621
-
1622
- expect(root_child0.getComputedLeft()).toBe(0)
1623
- expect(root_child0.getComputedTop()).toBe(0)
1624
- expect(root_child0.getComputedWidth()).toBe(50)
1625
- expect(root_child0.getComputedHeight()).toBe(50)
1626
-
1627
- expect(root_child1.getComputedLeft()).toBe(50)
1628
- expect(root_child1.getComputedTop()).toBe(40)
1629
- expect(root_child1.getComputedWidth()).toBe(50)
1630
- expect(root_child1.getComputedHeight()).toBe(50)
1631
-
1632
- expect(root_child1_child0.getComputedLeft()).toBe(0)
1633
- expect(root_child1_child0.getComputedTop()).toBe(0)
1634
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1635
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1636
-
1637
- expect(root_child2.getComputedLeft()).toBe(0)
1638
- expect(root_child2.getComputedTop()).toBe(100)
1639
- expect(root_child2.getComputedWidth()).toBe(50)
1640
- expect(root_child2.getComputedHeight()).toBe(20)
1641
-
1642
- expect(root_child2_child0.getComputedLeft()).toBe(0)
1643
- expect(root_child2_child0.getComputedTop()).toBe(0)
1644
- expect(root_child2_child0.getComputedWidth()).toBe(50)
1645
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1646
-
1647
- expect(root_child3.getComputedLeft()).toBe(50)
1648
- expect(root_child3.getComputedTop()).toBe(90)
1649
- expect(root_child3.getComputedWidth()).toBe(50)
1650
- expect(root_child3.getComputedHeight()).toBe(20)
1651
-
1652
- root.calculateLayout(undefined, undefined, Direction.RTL)
1653
-
1654
- expect(root.getComputedLeft()).toBe(0)
1655
- expect(root.getComputedTop()).toBe(0)
1656
- expect(root.getComputedWidth()).toBe(100)
1657
- expect(root.getComputedHeight()).toBe(100)
1658
-
1659
- expect(root_child0.getComputedLeft()).toBe(50)
1660
- expect(root_child0.getComputedTop()).toBe(0)
1661
- expect(root_child0.getComputedWidth()).toBe(50)
1662
- expect(root_child0.getComputedHeight()).toBe(50)
1663
-
1664
- expect(root_child1.getComputedLeft()).toBe(0)
1665
- expect(root_child1.getComputedTop()).toBe(40)
1666
- expect(root_child1.getComputedWidth()).toBe(50)
1667
- expect(root_child1.getComputedHeight()).toBe(50)
1668
-
1669
- expect(root_child1_child0.getComputedLeft()).toBe(0)
1670
- expect(root_child1_child0.getComputedTop()).toBe(0)
1671
- expect(root_child1_child0.getComputedWidth()).toBe(50)
1672
- expect(root_child1_child0.getComputedHeight()).toBe(10)
1673
-
1674
- expect(root_child2.getComputedLeft()).toBe(50)
1675
- expect(root_child2.getComputedTop()).toBe(100)
1676
- expect(root_child2.getComputedWidth()).toBe(50)
1677
- expect(root_child2.getComputedHeight()).toBe(20)
1678
-
1679
- expect(root_child2_child0.getComputedLeft()).toBe(0)
1680
- expect(root_child2_child0.getComputedTop()).toBe(0)
1681
- expect(root_child2_child0.getComputedWidth()).toBe(50)
1682
- expect(root_child2_child0.getComputedHeight()).toBe(10)
1683
-
1684
- expect(root_child3.getComputedLeft()).toBe(0)
1685
- expect(root_child3.getComputedTop()).toBe(90)
1686
- expect(root_child3.getComputedWidth()).toBe(50)
1687
- expect(root_child3.getComputedHeight()).toBe(20)
1688
- } finally {
1689
- if (typeof root !== "undefined") {
1690
- root.freeRecursive()
1691
- }
1692
-
1693
- config.free()
1694
- }
1695
- })
1696
- test("align_items_center_child_with_margin_bigger_than_parent", () => {
1697
- const config = Yoga.Config.create()
1698
- let root
1699
-
1700
- try {
1701
- root = Yoga.Node.create(config)
1702
- root.setJustifyContent(Justify.Center)
1703
- root.setAlignItems(Align.Center)
1704
- root.setPositionType(PositionType.Absolute)
1705
- root.setWidth(52)
1706
- root.setHeight(52)
1707
-
1708
- const root_child0 = Yoga.Node.create(config)
1709
- root_child0.setAlignItems(Align.Center)
1710
- root.insertChild(root_child0, 0)
1711
-
1712
- const root_child0_child0 = Yoga.Node.create(config)
1713
- root_child0_child0.setMargin(Edge.Left, 10)
1714
- root_child0_child0.setMargin(Edge.Right, 10)
1715
- root_child0_child0.setWidth(52)
1716
- root_child0_child0.setHeight(52)
1717
- root_child0.insertChild(root_child0_child0, 0)
1718
- root.calculateLayout(undefined, undefined, Direction.LTR)
1719
-
1720
- expect(root.getComputedLeft()).toBe(0)
1721
- expect(root.getComputedTop()).toBe(0)
1722
- expect(root.getComputedWidth()).toBe(52)
1723
- expect(root.getComputedHeight()).toBe(52)
1724
-
1725
- expect(root_child0.getComputedLeft()).toBe(-10)
1726
- expect(root_child0.getComputedTop()).toBe(0)
1727
- expect(root_child0.getComputedWidth()).toBe(72)
1728
- expect(root_child0.getComputedHeight()).toBe(52)
1729
-
1730
- expect(root_child0_child0.getComputedLeft()).toBe(10)
1731
- expect(root_child0_child0.getComputedTop()).toBe(0)
1732
- expect(root_child0_child0.getComputedWidth()).toBe(52)
1733
- expect(root_child0_child0.getComputedHeight()).toBe(52)
1734
-
1735
- root.calculateLayout(undefined, undefined, Direction.RTL)
1736
-
1737
- expect(root.getComputedLeft()).toBe(0)
1738
- expect(root.getComputedTop()).toBe(0)
1739
- expect(root.getComputedWidth()).toBe(52)
1740
- expect(root.getComputedHeight()).toBe(52)
1741
-
1742
- expect(root_child0.getComputedLeft()).toBe(-10)
1743
- expect(root_child0.getComputedTop()).toBe(0)
1744
- expect(root_child0.getComputedWidth()).toBe(72)
1745
- expect(root_child0.getComputedHeight()).toBe(52)
1746
-
1747
- expect(root_child0_child0.getComputedLeft()).toBe(10)
1748
- expect(root_child0_child0.getComputedTop()).toBe(0)
1749
- expect(root_child0_child0.getComputedWidth()).toBe(52)
1750
- expect(root_child0_child0.getComputedHeight()).toBe(52)
1751
- } finally {
1752
- if (typeof root !== "undefined") {
1753
- root.freeRecursive()
1754
- }
1755
-
1756
- config.free()
1757
- }
1758
- })
1759
- test("align_items_flex_end_child_with_margin_bigger_than_parent", () => {
1760
- const config = Yoga.Config.create()
1761
- let root
1762
-
1763
- try {
1764
- root = Yoga.Node.create(config)
1765
- root.setJustifyContent(Justify.Center)
1766
- root.setAlignItems(Align.Center)
1767
- root.setPositionType(PositionType.Absolute)
1768
- root.setWidth(52)
1769
- root.setHeight(52)
1770
-
1771
- const root_child0 = Yoga.Node.create(config)
1772
- root_child0.setAlignItems(Align.FlexEnd)
1773
- root.insertChild(root_child0, 0)
1774
-
1775
- const root_child0_child0 = Yoga.Node.create(config)
1776
- root_child0_child0.setMargin(Edge.Left, 10)
1777
- root_child0_child0.setMargin(Edge.Right, 10)
1778
- root_child0_child0.setWidth(52)
1779
- root_child0_child0.setHeight(52)
1780
- root_child0.insertChild(root_child0_child0, 0)
1781
- root.calculateLayout(undefined, undefined, Direction.LTR)
1782
-
1783
- expect(root.getComputedLeft()).toBe(0)
1784
- expect(root.getComputedTop()).toBe(0)
1785
- expect(root.getComputedWidth()).toBe(52)
1786
- expect(root.getComputedHeight()).toBe(52)
1787
-
1788
- expect(root_child0.getComputedLeft()).toBe(-10)
1789
- expect(root_child0.getComputedTop()).toBe(0)
1790
- expect(root_child0.getComputedWidth()).toBe(72)
1791
- expect(root_child0.getComputedHeight()).toBe(52)
1792
-
1793
- expect(root_child0_child0.getComputedLeft()).toBe(10)
1794
- expect(root_child0_child0.getComputedTop()).toBe(0)
1795
- expect(root_child0_child0.getComputedWidth()).toBe(52)
1796
- expect(root_child0_child0.getComputedHeight()).toBe(52)
1797
-
1798
- root.calculateLayout(undefined, undefined, Direction.RTL)
1799
-
1800
- expect(root.getComputedLeft()).toBe(0)
1801
- expect(root.getComputedTop()).toBe(0)
1802
- expect(root.getComputedWidth()).toBe(52)
1803
- expect(root.getComputedHeight()).toBe(52)
1804
-
1805
- expect(root_child0.getComputedLeft()).toBe(-10)
1806
- expect(root_child0.getComputedTop()).toBe(0)
1807
- expect(root_child0.getComputedWidth()).toBe(72)
1808
- expect(root_child0.getComputedHeight()).toBe(52)
1809
-
1810
- expect(root_child0_child0.getComputedLeft()).toBe(10)
1811
- expect(root_child0_child0.getComputedTop()).toBe(0)
1812
- expect(root_child0_child0.getComputedWidth()).toBe(52)
1813
- expect(root_child0_child0.getComputedHeight()).toBe(52)
1814
- } finally {
1815
- if (typeof root !== "undefined") {
1816
- root.freeRecursive()
1817
- }
1818
-
1819
- config.free()
1820
- }
1821
- })
1822
- test("align_items_center_child_without_margin_bigger_than_parent", () => {
1823
- const config = Yoga.Config.create()
1824
- let root
1825
-
1826
- try {
1827
- root = Yoga.Node.create(config)
1828
- root.setJustifyContent(Justify.Center)
1829
- root.setAlignItems(Align.Center)
1830
- root.setPositionType(PositionType.Absolute)
1831
- root.setWidth(52)
1832
- root.setHeight(52)
1833
-
1834
- const root_child0 = Yoga.Node.create(config)
1835
- root_child0.setAlignItems(Align.Center)
1836
- root.insertChild(root_child0, 0)
1837
-
1838
- const root_child0_child0 = Yoga.Node.create(config)
1839
- root_child0_child0.setWidth(72)
1840
- root_child0_child0.setHeight(72)
1841
- root_child0.insertChild(root_child0_child0, 0)
1842
- root.calculateLayout(undefined, undefined, Direction.LTR)
1843
-
1844
- expect(root.getComputedLeft()).toBe(0)
1845
- expect(root.getComputedTop()).toBe(0)
1846
- expect(root.getComputedWidth()).toBe(52)
1847
- expect(root.getComputedHeight()).toBe(52)
1848
-
1849
- expect(root_child0.getComputedLeft()).toBe(-10)
1850
- expect(root_child0.getComputedTop()).toBe(-10)
1851
- expect(root_child0.getComputedWidth()).toBe(72)
1852
- expect(root_child0.getComputedHeight()).toBe(72)
1853
-
1854
- expect(root_child0_child0.getComputedLeft()).toBe(0)
1855
- expect(root_child0_child0.getComputedTop()).toBe(0)
1856
- expect(root_child0_child0.getComputedWidth()).toBe(72)
1857
- expect(root_child0_child0.getComputedHeight()).toBe(72)
1858
-
1859
- root.calculateLayout(undefined, undefined, Direction.RTL)
1860
-
1861
- expect(root.getComputedLeft()).toBe(0)
1862
- expect(root.getComputedTop()).toBe(0)
1863
- expect(root.getComputedWidth()).toBe(52)
1864
- expect(root.getComputedHeight()).toBe(52)
1865
-
1866
- expect(root_child0.getComputedLeft()).toBe(-10)
1867
- expect(root_child0.getComputedTop()).toBe(-10)
1868
- expect(root_child0.getComputedWidth()).toBe(72)
1869
- expect(root_child0.getComputedHeight()).toBe(72)
1870
-
1871
- expect(root_child0_child0.getComputedLeft()).toBe(0)
1872
- expect(root_child0_child0.getComputedTop()).toBe(0)
1873
- expect(root_child0_child0.getComputedWidth()).toBe(72)
1874
- expect(root_child0_child0.getComputedHeight()).toBe(72)
1875
- } finally {
1876
- if (typeof root !== "undefined") {
1877
- root.freeRecursive()
1878
- }
1879
-
1880
- config.free()
1881
- }
1882
- })
1883
- test("align_items_flex_end_child_without_margin_bigger_than_parent", () => {
1884
- const config = Yoga.Config.create()
1885
- let root
1886
-
1887
- try {
1888
- root = Yoga.Node.create(config)
1889
- root.setJustifyContent(Justify.Center)
1890
- root.setAlignItems(Align.Center)
1891
- root.setPositionType(PositionType.Absolute)
1892
- root.setWidth(52)
1893
- root.setHeight(52)
1894
-
1895
- const root_child0 = Yoga.Node.create(config)
1896
- root_child0.setAlignItems(Align.FlexEnd)
1897
- root.insertChild(root_child0, 0)
1898
-
1899
- const root_child0_child0 = Yoga.Node.create(config)
1900
- root_child0_child0.setWidth(72)
1901
- root_child0_child0.setHeight(72)
1902
- root_child0.insertChild(root_child0_child0, 0)
1903
- root.calculateLayout(undefined, undefined, Direction.LTR)
1904
-
1905
- expect(root.getComputedLeft()).toBe(0)
1906
- expect(root.getComputedTop()).toBe(0)
1907
- expect(root.getComputedWidth()).toBe(52)
1908
- expect(root.getComputedHeight()).toBe(52)
1909
-
1910
- expect(root_child0.getComputedLeft()).toBe(-10)
1911
- expect(root_child0.getComputedTop()).toBe(-10)
1912
- expect(root_child0.getComputedWidth()).toBe(72)
1913
- expect(root_child0.getComputedHeight()).toBe(72)
1914
-
1915
- expect(root_child0_child0.getComputedLeft()).toBe(0)
1916
- expect(root_child0_child0.getComputedTop()).toBe(0)
1917
- expect(root_child0_child0.getComputedWidth()).toBe(72)
1918
- expect(root_child0_child0.getComputedHeight()).toBe(72)
1919
-
1920
- root.calculateLayout(undefined, undefined, Direction.RTL)
1921
-
1922
- expect(root.getComputedLeft()).toBe(0)
1923
- expect(root.getComputedTop()).toBe(0)
1924
- expect(root.getComputedWidth()).toBe(52)
1925
- expect(root.getComputedHeight()).toBe(52)
1926
-
1927
- expect(root_child0.getComputedLeft()).toBe(-10)
1928
- expect(root_child0.getComputedTop()).toBe(-10)
1929
- expect(root_child0.getComputedWidth()).toBe(72)
1930
- expect(root_child0.getComputedHeight()).toBe(72)
1931
-
1932
- expect(root_child0_child0.getComputedLeft()).toBe(0)
1933
- expect(root_child0_child0.getComputedTop()).toBe(0)
1934
- expect(root_child0_child0.getComputedWidth()).toBe(72)
1935
- expect(root_child0_child0.getComputedHeight()).toBe(72)
1936
- } finally {
1937
- if (typeof root !== "undefined") {
1938
- root.freeRecursive()
1939
- }
1940
-
1941
- config.free()
1942
- }
1943
- })
1944
- test("align_center_should_size_based_on_content", () => {
1945
- const config = Yoga.Config.create()
1946
- let root
1947
-
1948
- try {
1949
- root = Yoga.Node.create(config)
1950
- root.setAlignItems(Align.Center)
1951
- root.setPositionType(PositionType.Absolute)
1952
- root.setMargin(Edge.Top, 20)
1953
- root.setWidth(100)
1954
- root.setHeight(100)
1955
-
1956
- const root_child0 = Yoga.Node.create(config)
1957
- root_child0.setJustifyContent(Justify.Center)
1958
- root_child0.setFlexShrink(1)
1959
- root.insertChild(root_child0, 0)
1960
-
1961
- const root_child0_child0 = Yoga.Node.create(config)
1962
- root_child0_child0.setFlexGrow(1)
1963
- root_child0_child0.setFlexShrink(1)
1964
- root_child0.insertChild(root_child0_child0, 0)
1965
-
1966
- const root_child0_child0_child0 = Yoga.Node.create(config)
1967
- root_child0_child0_child0.setWidth(20)
1968
- root_child0_child0_child0.setHeight(20)
1969
- root_child0_child0.insertChild(root_child0_child0_child0, 0)
1970
- root.calculateLayout(undefined, undefined, Direction.LTR)
1971
-
1972
- expect(root.getComputedLeft()).toBe(0)
1973
- expect(root.getComputedTop()).toBe(20)
1974
- expect(root.getComputedWidth()).toBe(100)
1975
- expect(root.getComputedHeight()).toBe(100)
1976
-
1977
- expect(root_child0.getComputedLeft()).toBe(40)
1978
- expect(root_child0.getComputedTop()).toBe(0)
1979
- expect(root_child0.getComputedWidth()).toBe(20)
1980
- expect(root_child0.getComputedHeight()).toBe(20)
1981
-
1982
- expect(root_child0_child0.getComputedLeft()).toBe(0)
1983
- expect(root_child0_child0.getComputedTop()).toBe(0)
1984
- expect(root_child0_child0.getComputedWidth()).toBe(20)
1985
- expect(root_child0_child0.getComputedHeight()).toBe(20)
1986
-
1987
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
1988
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
1989
- expect(root_child0_child0_child0.getComputedWidth()).toBe(20)
1990
- expect(root_child0_child0_child0.getComputedHeight()).toBe(20)
1991
-
1992
- root.calculateLayout(undefined, undefined, Direction.RTL)
1993
-
1994
- expect(root.getComputedLeft()).toBe(0)
1995
- expect(root.getComputedTop()).toBe(20)
1996
- expect(root.getComputedWidth()).toBe(100)
1997
- expect(root.getComputedHeight()).toBe(100)
1998
-
1999
- expect(root_child0.getComputedLeft()).toBe(40)
2000
- expect(root_child0.getComputedTop()).toBe(0)
2001
- expect(root_child0.getComputedWidth()).toBe(20)
2002
- expect(root_child0.getComputedHeight()).toBe(20)
2003
-
2004
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2005
- expect(root_child0_child0.getComputedTop()).toBe(0)
2006
- expect(root_child0_child0.getComputedWidth()).toBe(20)
2007
- expect(root_child0_child0.getComputedHeight()).toBe(20)
2008
-
2009
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2010
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2011
- expect(root_child0_child0_child0.getComputedWidth()).toBe(20)
2012
- expect(root_child0_child0_child0.getComputedHeight()).toBe(20)
2013
- } finally {
2014
- if (typeof root !== "undefined") {
2015
- root.freeRecursive()
2016
- }
2017
-
2018
- config.free()
2019
- }
2020
- })
2021
- test("align_stretch_should_size_based_on_parent", () => {
2022
- const config = Yoga.Config.create()
2023
- let root
2024
-
2025
- try {
2026
- root = Yoga.Node.create(config)
2027
- root.setPositionType(PositionType.Absolute)
2028
- root.setMargin(Edge.Top, 20)
2029
- root.setWidth(100)
2030
- root.setHeight(100)
2031
-
2032
- const root_child0 = Yoga.Node.create(config)
2033
- root_child0.setJustifyContent(Justify.Center)
2034
- root_child0.setFlexShrink(1)
2035
- root.insertChild(root_child0, 0)
2036
-
2037
- const root_child0_child0 = Yoga.Node.create(config)
2038
- root_child0_child0.setFlexGrow(1)
2039
- root_child0_child0.setFlexShrink(1)
2040
- root_child0.insertChild(root_child0_child0, 0)
2041
-
2042
- const root_child0_child0_child0 = Yoga.Node.create(config)
2043
- root_child0_child0_child0.setWidth(20)
2044
- root_child0_child0_child0.setHeight(20)
2045
- root_child0_child0.insertChild(root_child0_child0_child0, 0)
2046
- root.calculateLayout(undefined, undefined, Direction.LTR)
2047
-
2048
- expect(root.getComputedLeft()).toBe(0)
2049
- expect(root.getComputedTop()).toBe(20)
2050
- expect(root.getComputedWidth()).toBe(100)
2051
- expect(root.getComputedHeight()).toBe(100)
2052
-
2053
- expect(root_child0.getComputedLeft()).toBe(0)
2054
- expect(root_child0.getComputedTop()).toBe(0)
2055
- expect(root_child0.getComputedWidth()).toBe(100)
2056
- expect(root_child0.getComputedHeight()).toBe(20)
2057
-
2058
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2059
- expect(root_child0_child0.getComputedTop()).toBe(0)
2060
- expect(root_child0_child0.getComputedWidth()).toBe(100)
2061
- expect(root_child0_child0.getComputedHeight()).toBe(20)
2062
-
2063
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2064
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2065
- expect(root_child0_child0_child0.getComputedWidth()).toBe(20)
2066
- expect(root_child0_child0_child0.getComputedHeight()).toBe(20)
2067
-
2068
- root.calculateLayout(undefined, undefined, Direction.RTL)
2069
-
2070
- expect(root.getComputedLeft()).toBe(0)
2071
- expect(root.getComputedTop()).toBe(20)
2072
- expect(root.getComputedWidth()).toBe(100)
2073
- expect(root.getComputedHeight()).toBe(100)
2074
-
2075
- expect(root_child0.getComputedLeft()).toBe(0)
2076
- expect(root_child0.getComputedTop()).toBe(0)
2077
- expect(root_child0.getComputedWidth()).toBe(100)
2078
- expect(root_child0.getComputedHeight()).toBe(20)
2079
-
2080
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2081
- expect(root_child0_child0.getComputedTop()).toBe(0)
2082
- expect(root_child0_child0.getComputedWidth()).toBe(100)
2083
- expect(root_child0_child0.getComputedHeight()).toBe(20)
2084
-
2085
- expect(root_child0_child0_child0.getComputedLeft()).toBe(80)
2086
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2087
- expect(root_child0_child0_child0.getComputedWidth()).toBe(20)
2088
- expect(root_child0_child0_child0.getComputedHeight()).toBe(20)
2089
- } finally {
2090
- if (typeof root !== "undefined") {
2091
- root.freeRecursive()
2092
- }
2093
-
2094
- config.free()
2095
- }
2096
- })
2097
- test("align_flex_start_with_shrinking_children", () => {
2098
- const config = Yoga.Config.create()
2099
- let root
2100
-
2101
- try {
2102
- root = Yoga.Node.create(config)
2103
- root.setPositionType(PositionType.Absolute)
2104
- root.setWidth(500)
2105
- root.setHeight(500)
2106
-
2107
- const root_child0 = Yoga.Node.create(config)
2108
- root_child0.setAlignItems(Align.FlexStart)
2109
- root.insertChild(root_child0, 0)
2110
-
2111
- const root_child0_child0 = Yoga.Node.create(config)
2112
- root_child0_child0.setFlexGrow(1)
2113
- root_child0_child0.setFlexShrink(1)
2114
- root_child0.insertChild(root_child0_child0, 0)
2115
-
2116
- const root_child0_child0_child0 = Yoga.Node.create(config)
2117
- root_child0_child0_child0.setFlexGrow(1)
2118
- root_child0_child0_child0.setFlexShrink(1)
2119
- root_child0_child0.insertChild(root_child0_child0_child0, 0)
2120
- root.calculateLayout(undefined, undefined, Direction.LTR)
2121
-
2122
- expect(root.getComputedLeft()).toBe(0)
2123
- expect(root.getComputedTop()).toBe(0)
2124
- expect(root.getComputedWidth()).toBe(500)
2125
- expect(root.getComputedHeight()).toBe(500)
2126
-
2127
- expect(root_child0.getComputedLeft()).toBe(0)
2128
- expect(root_child0.getComputedTop()).toBe(0)
2129
- expect(root_child0.getComputedWidth()).toBe(500)
2130
- expect(root_child0.getComputedHeight()).toBe(0)
2131
-
2132
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2133
- expect(root_child0_child0.getComputedTop()).toBe(0)
2134
- expect(root_child0_child0.getComputedWidth()).toBe(0)
2135
- expect(root_child0_child0.getComputedHeight()).toBe(0)
2136
-
2137
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2138
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2139
- expect(root_child0_child0_child0.getComputedWidth()).toBe(0)
2140
- expect(root_child0_child0_child0.getComputedHeight()).toBe(0)
2141
-
2142
- root.calculateLayout(undefined, undefined, Direction.RTL)
2143
-
2144
- expect(root.getComputedLeft()).toBe(0)
2145
- expect(root.getComputedTop()).toBe(0)
2146
- expect(root.getComputedWidth()).toBe(500)
2147
- expect(root.getComputedHeight()).toBe(500)
2148
-
2149
- expect(root_child0.getComputedLeft()).toBe(0)
2150
- expect(root_child0.getComputedTop()).toBe(0)
2151
- expect(root_child0.getComputedWidth()).toBe(500)
2152
- expect(root_child0.getComputedHeight()).toBe(0)
2153
-
2154
- expect(root_child0_child0.getComputedLeft()).toBe(500)
2155
- expect(root_child0_child0.getComputedTop()).toBe(0)
2156
- expect(root_child0_child0.getComputedWidth()).toBe(0)
2157
- expect(root_child0_child0.getComputedHeight()).toBe(0)
2158
-
2159
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2160
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2161
- expect(root_child0_child0_child0.getComputedWidth()).toBe(0)
2162
- expect(root_child0_child0_child0.getComputedHeight()).toBe(0)
2163
- } finally {
2164
- if (typeof root !== "undefined") {
2165
- root.freeRecursive()
2166
- }
2167
-
2168
- config.free()
2169
- }
2170
- })
2171
- test("align_flex_start_with_stretching_children", () => {
2172
- const config = Yoga.Config.create()
2173
- let root
2174
-
2175
- try {
2176
- root = Yoga.Node.create(config)
2177
- root.setPositionType(PositionType.Absolute)
2178
- root.setWidth(500)
2179
- root.setHeight(500)
2180
-
2181
- const root_child0 = Yoga.Node.create(config)
2182
- root.insertChild(root_child0, 0)
2183
-
2184
- const root_child0_child0 = Yoga.Node.create(config)
2185
- root_child0_child0.setFlexGrow(1)
2186
- root_child0_child0.setFlexShrink(1)
2187
- root_child0.insertChild(root_child0_child0, 0)
2188
-
2189
- const root_child0_child0_child0 = Yoga.Node.create(config)
2190
- root_child0_child0_child0.setFlexGrow(1)
2191
- root_child0_child0_child0.setFlexShrink(1)
2192
- root_child0_child0.insertChild(root_child0_child0_child0, 0)
2193
- root.calculateLayout(undefined, undefined, Direction.LTR)
2194
-
2195
- expect(root.getComputedLeft()).toBe(0)
2196
- expect(root.getComputedTop()).toBe(0)
2197
- expect(root.getComputedWidth()).toBe(500)
2198
- expect(root.getComputedHeight()).toBe(500)
2199
-
2200
- expect(root_child0.getComputedLeft()).toBe(0)
2201
- expect(root_child0.getComputedTop()).toBe(0)
2202
- expect(root_child0.getComputedWidth()).toBe(500)
2203
- expect(root_child0.getComputedHeight()).toBe(0)
2204
-
2205
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2206
- expect(root_child0_child0.getComputedTop()).toBe(0)
2207
- expect(root_child0_child0.getComputedWidth()).toBe(500)
2208
- expect(root_child0_child0.getComputedHeight()).toBe(0)
2209
-
2210
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2211
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2212
- expect(root_child0_child0_child0.getComputedWidth()).toBe(500)
2213
- expect(root_child0_child0_child0.getComputedHeight()).toBe(0)
2214
-
2215
- root.calculateLayout(undefined, undefined, Direction.RTL)
2216
-
2217
- expect(root.getComputedLeft()).toBe(0)
2218
- expect(root.getComputedTop()).toBe(0)
2219
- expect(root.getComputedWidth()).toBe(500)
2220
- expect(root.getComputedHeight()).toBe(500)
2221
-
2222
- expect(root_child0.getComputedLeft()).toBe(0)
2223
- expect(root_child0.getComputedTop()).toBe(0)
2224
- expect(root_child0.getComputedWidth()).toBe(500)
2225
- expect(root_child0.getComputedHeight()).toBe(0)
2226
-
2227
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2228
- expect(root_child0_child0.getComputedTop()).toBe(0)
2229
- expect(root_child0_child0.getComputedWidth()).toBe(500)
2230
- expect(root_child0_child0.getComputedHeight()).toBe(0)
2231
-
2232
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2233
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2234
- expect(root_child0_child0_child0.getComputedWidth()).toBe(500)
2235
- expect(root_child0_child0_child0.getComputedHeight()).toBe(0)
2236
- } finally {
2237
- if (typeof root !== "undefined") {
2238
- root.freeRecursive()
2239
- }
2240
-
2241
- config.free()
2242
- }
2243
- })
2244
- test("align_flex_start_with_shrinking_children_with_stretch", () => {
2245
- const config = Yoga.Config.create()
2246
- let root
2247
-
2248
- try {
2249
- root = Yoga.Node.create(config)
2250
- root.setPositionType(PositionType.Absolute)
2251
- root.setWidth(500)
2252
- root.setHeight(500)
2253
-
2254
- const root_child0 = Yoga.Node.create(config)
2255
- root_child0.setAlignItems(Align.FlexStart)
2256
- root.insertChild(root_child0, 0)
2257
-
2258
- const root_child0_child0 = Yoga.Node.create(config)
2259
- root_child0_child0.setFlexGrow(1)
2260
- root_child0_child0.setFlexShrink(1)
2261
- root_child0.insertChild(root_child0_child0, 0)
2262
-
2263
- const root_child0_child0_child0 = Yoga.Node.create(config)
2264
- root_child0_child0_child0.setFlexGrow(1)
2265
- root_child0_child0_child0.setFlexShrink(1)
2266
- root_child0_child0.insertChild(root_child0_child0_child0, 0)
2267
- root.calculateLayout(undefined, undefined, Direction.LTR)
2268
-
2269
- expect(root.getComputedLeft()).toBe(0)
2270
- expect(root.getComputedTop()).toBe(0)
2271
- expect(root.getComputedWidth()).toBe(500)
2272
- expect(root.getComputedHeight()).toBe(500)
2273
-
2274
- expect(root_child0.getComputedLeft()).toBe(0)
2275
- expect(root_child0.getComputedTop()).toBe(0)
2276
- expect(root_child0.getComputedWidth()).toBe(500)
2277
- expect(root_child0.getComputedHeight()).toBe(0)
2278
-
2279
- expect(root_child0_child0.getComputedLeft()).toBe(0)
2280
- expect(root_child0_child0.getComputedTop()).toBe(0)
2281
- expect(root_child0_child0.getComputedWidth()).toBe(0)
2282
- expect(root_child0_child0.getComputedHeight()).toBe(0)
2283
-
2284
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2285
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2286
- expect(root_child0_child0_child0.getComputedWidth()).toBe(0)
2287
- expect(root_child0_child0_child0.getComputedHeight()).toBe(0)
2288
-
2289
- root.calculateLayout(undefined, undefined, Direction.RTL)
2290
-
2291
- expect(root.getComputedLeft()).toBe(0)
2292
- expect(root.getComputedTop()).toBe(0)
2293
- expect(root.getComputedWidth()).toBe(500)
2294
- expect(root.getComputedHeight()).toBe(500)
2295
-
2296
- expect(root_child0.getComputedLeft()).toBe(0)
2297
- expect(root_child0.getComputedTop()).toBe(0)
2298
- expect(root_child0.getComputedWidth()).toBe(500)
2299
- expect(root_child0.getComputedHeight()).toBe(0)
2300
-
2301
- expect(root_child0_child0.getComputedLeft()).toBe(500)
2302
- expect(root_child0_child0.getComputedTop()).toBe(0)
2303
- expect(root_child0_child0.getComputedWidth()).toBe(0)
2304
- expect(root_child0_child0.getComputedHeight()).toBe(0)
2305
-
2306
- expect(root_child0_child0_child0.getComputedLeft()).toBe(0)
2307
- expect(root_child0_child0_child0.getComputedTop()).toBe(0)
2308
- expect(root_child0_child0_child0.getComputedWidth()).toBe(0)
2309
- expect(root_child0_child0_child0.getComputedHeight()).toBe(0)
2310
- } finally {
2311
- if (typeof root !== "undefined") {
2312
- root.freeRecursive()
2313
- }
2314
-
2315
- config.free()
2316
- }
2317
- })
2318
- test("align_flex_end_with_row_reverse", () => {
2319
- const config = Yoga.Config.create()
2320
- let root
2321
-
2322
- try {
2323
- root = Yoga.Node.create(config)
2324
- root.setAlignItems(Align.FlexEnd)
2325
- root.setPositionType(PositionType.Absolute)
2326
- root.setFlexWrap(Wrap.Wrap)
2327
- root.setWidth(100)
2328
- root.setHeight(75)
2329
-
2330
- const root_child0 = Yoga.Node.create(config)
2331
- root_child0.setMargin(Edge.Left, 3)
2332
- root_child0.setMargin(Edge.Right, 5)
2333
- root_child0.setWidth(50)
2334
- root_child0.setHeight(50)
2335
- root.insertChild(root_child0, 0)
2336
-
2337
- const root_child1 = Yoga.Node.create(config)
2338
- root_child1.setWidth(50)
2339
- root_child1.setHeight(50)
2340
- root.insertChild(root_child1, 1)
2341
- root.calculateLayout(undefined, undefined, Direction.LTR)
2342
-
2343
- expect(root.getComputedLeft()).toBe(0)
2344
- expect(root.getComputedTop()).toBe(0)
2345
- expect(root.getComputedWidth()).toBe(100)
2346
- expect(root.getComputedHeight()).toBe(75)
2347
-
2348
- expect(root_child0.getComputedLeft()).toBe(3)
2349
- expect(root_child0.getComputedTop()).toBe(0)
2350
- expect(root_child0.getComputedWidth()).toBe(50)
2351
- expect(root_child0.getComputedHeight()).toBe(50)
2352
-
2353
- expect(root_child1.getComputedLeft()).toBe(58)
2354
- expect(root_child1.getComputedTop()).toBe(0)
2355
- expect(root_child1.getComputedWidth()).toBe(50)
2356
- expect(root_child1.getComputedHeight()).toBe(50)
2357
-
2358
- root.calculateLayout(undefined, undefined, Direction.RTL)
2359
-
2360
- expect(root.getComputedLeft()).toBe(0)
2361
- expect(root.getComputedTop()).toBe(0)
2362
- expect(root.getComputedWidth()).toBe(100)
2363
- expect(root.getComputedHeight()).toBe(75)
2364
-
2365
- expect(root_child0.getComputedLeft()).toBe(45)
2366
- expect(root_child0.getComputedTop()).toBe(0)
2367
- expect(root_child0.getComputedWidth()).toBe(50)
2368
- expect(root_child0.getComputedHeight()).toBe(50)
2369
-
2370
- expect(root_child1.getComputedLeft()).toBe(-8)
2371
- expect(root_child1.getComputedTop()).toBe(0)
2372
- expect(root_child1.getComputedWidth()).toBe(50)
2373
- expect(root_child1.getComputedHeight()).toBe(50)
2374
- } finally {
2375
- if (typeof root !== "undefined") {
2376
- root.freeRecursive()
2377
- }
2378
-
2379
- config.free()
2380
- }
2381
- })
2382
- test("align_stretch_with_row_reverse", () => {
2383
- const config = Yoga.Config.create()
2384
- let root
2385
-
2386
- try {
2387
- root = Yoga.Node.create(config)
2388
- root.setPositionType(PositionType.Absolute)
2389
- root.setFlexWrap(Wrap.Wrap)
2390
- root.setWidth(100)
2391
- root.setHeight(75)
2392
-
2393
- const root_child0 = Yoga.Node.create(config)
2394
- root_child0.setMargin(Edge.Left, 3)
2395
- root_child0.setMargin(Edge.Right, 5)
2396
- root_child0.setWidth(50)
2397
- root_child0.setHeight(50)
2398
- root.insertChild(root_child0, 0)
2399
-
2400
- const root_child1 = Yoga.Node.create(config)
2401
- root_child1.setWidth(50)
2402
- root_child1.setHeight(50)
2403
- root.insertChild(root_child1, 1)
2404
- root.calculateLayout(undefined, undefined, Direction.LTR)
2405
-
2406
- expect(root.getComputedLeft()).toBe(0)
2407
- expect(root.getComputedTop()).toBe(0)
2408
- expect(root.getComputedWidth()).toBe(100)
2409
- expect(root.getComputedHeight()).toBe(75)
2410
-
2411
- expect(root_child0.getComputedLeft()).toBe(3)
2412
- expect(root_child0.getComputedTop()).toBe(0)
2413
- expect(root_child0.getComputedWidth()).toBe(50)
2414
- expect(root_child0.getComputedHeight()).toBe(50)
2415
-
2416
- expect(root_child1.getComputedLeft()).toBe(58)
2417
- expect(root_child1.getComputedTop()).toBe(0)
2418
- expect(root_child1.getComputedWidth()).toBe(50)
2419
- expect(root_child1.getComputedHeight()).toBe(50)
2420
-
2421
- root.calculateLayout(undefined, undefined, Direction.RTL)
2422
-
2423
- expect(root.getComputedLeft()).toBe(0)
2424
- expect(root.getComputedTop()).toBe(0)
2425
- expect(root.getComputedWidth()).toBe(100)
2426
- expect(root.getComputedHeight()).toBe(75)
2427
-
2428
- expect(root_child0.getComputedLeft()).toBe(45)
2429
- expect(root_child0.getComputedTop()).toBe(0)
2430
- expect(root_child0.getComputedWidth()).toBe(50)
2431
- expect(root_child0.getComputedHeight()).toBe(50)
2432
-
2433
- expect(root_child1.getComputedLeft()).toBe(-8)
2434
- expect(root_child1.getComputedTop()).toBe(0)
2435
- expect(root_child1.getComputedWidth()).toBe(50)
2436
- expect(root_child1.getComputedHeight()).toBe(50)
2437
- } finally {
2438
- if (typeof root !== "undefined") {
2439
- root.freeRecursive()
2440
- }
2441
-
2442
- config.free()
2443
- }
2444
- })