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