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