@oidoid/void 0.1.7 → 0.1.8

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 (168) hide show
  1. package/dist/public/index.js +1 -1
  2. package/dist/public/index.js.map +1 -1
  3. package/dist/public/{void-v0.1.7+20260106.c6b562a.html → void-v0.1.8+20260106.f2ce523.html} +2 -2
  4. package/dist/src/demo/ents/clock.test.d.ts +2 -0
  5. package/dist/src/demo/ents/clock.test.d.ts.map +1 -0
  6. package/dist/src/demo/ents/clock.test.js +24 -0
  7. package/dist/src/demo/ents/clock.test.js.map +1 -0
  8. package/dist/src/demo/tsconfig.json +3 -3
  9. package/dist/src/ents/cursor.test.d.ts +2 -0
  10. package/dist/src/ents/cursor.test.d.ts.map +1 -0
  11. package/dist/src/ents/cursor.test.js +92 -0
  12. package/dist/src/ents/cursor.test.js.map +1 -0
  13. package/dist/src/ents/ent-query.test.d.ts +11 -0
  14. package/dist/src/ents/ent-query.test.d.ts.map +1 -0
  15. package/dist/src/ents/ent-query.test.js +63 -0
  16. package/dist/src/ents/ent-query.test.js.map +1 -0
  17. package/dist/src/graphics/atlas-parser.test.d.ts +2 -0
  18. package/dist/src/graphics/atlas-parser.test.d.ts.map +1 -0
  19. package/dist/src/graphics/atlas-parser.test.js +100 -0
  20. package/dist/src/graphics/atlas-parser.test.js.map +1 -0
  21. package/dist/src/graphics/cam.test.d.ts +2 -0
  22. package/dist/src/graphics/cam.test.d.ts.map +1 -0
  23. package/dist/src/graphics/cam.test.js +456 -0
  24. package/dist/src/graphics/cam.test.js.map +1 -0
  25. package/dist/src/graphics/layer.test.d.ts +2 -0
  26. package/dist/src/graphics/layer.test.d.ts.map +1 -0
  27. package/dist/src/graphics/layer.test.js +23 -0
  28. package/dist/src/graphics/layer.test.js.map +1 -0
  29. package/dist/src/graphics/renderer.test.d.ts +2 -0
  30. package/dist/src/graphics/renderer.test.d.ts.map +1 -0
  31. package/dist/src/graphics/renderer.test.js +92 -0
  32. package/dist/src/graphics/renderer.test.js.map +1 -0
  33. package/dist/src/graphics/sprite.test.d.ts +2 -0
  34. package/dist/src/graphics/sprite.test.d.ts.map +1 -0
  35. package/dist/src/graphics/sprite.test.js +582 -0
  36. package/dist/src/graphics/sprite.test.js.map +1 -0
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +0 -1
  39. package/dist/src/index.js.map +1 -1
  40. package/dist/src/input/context-menu.test.d.ts +2 -0
  41. package/dist/src/input/context-menu.test.d.ts.map +1 -0
  42. package/dist/src/input/context-menu.test.js +111 -0
  43. package/dist/src/input/context-menu.test.js.map +1 -0
  44. package/dist/src/input/gamepad.test.d.ts +2 -0
  45. package/dist/src/input/gamepad.test.d.ts.map +1 -0
  46. package/dist/src/input/gamepad.test.js +172 -0
  47. package/dist/src/input/gamepad.test.js.map +1 -0
  48. package/dist/src/input/input.test.d.ts +2 -0
  49. package/dist/src/input/input.test.d.ts.map +1 -0
  50. package/dist/src/input/input.test.js +1146 -0
  51. package/dist/src/input/input.test.js.map +1 -0
  52. package/dist/src/input/keyboard.test.d.ts +2 -0
  53. package/dist/src/input/keyboard.test.d.ts.map +1 -0
  54. package/dist/src/input/keyboard.test.js +159 -0
  55. package/dist/src/input/keyboard.test.js.map +1 -0
  56. package/dist/src/input/pointer.test.d.ts +2 -0
  57. package/dist/src/input/pointer.test.d.ts.map +1 -0
  58. package/dist/src/input/pointer.test.js +339 -0
  59. package/dist/src/input/pointer.test.js.map +1 -0
  60. package/dist/src/input/wheel.test.d.ts +2 -0
  61. package/dist/src/input/wheel.test.d.ts.map +1 -0
  62. package/dist/src/input/wheel.test.js +92 -0
  63. package/dist/src/input/wheel.test.js.map +1 -0
  64. package/dist/src/level/level-parser.test.d.ts +20 -0
  65. package/dist/src/level/level-parser.test.d.ts.map +1 -0
  66. package/dist/src/level/level-parser.test.js +340 -0
  67. package/dist/src/level/level-parser.test.js.map +1 -0
  68. package/dist/src/looper.test.d.ts +2 -0
  69. package/dist/src/looper.test.d.ts.map +1 -0
  70. package/dist/src/looper.test.js +128 -0
  71. package/dist/src/looper.test.js.map +1 -0
  72. package/dist/src/mem/pool.test.d.ts +2 -0
  73. package/dist/src/mem/pool.test.d.ts.map +1 -0
  74. package/dist/src/mem/pool.test.js +120 -0
  75. package/dist/src/mem/pool.test.js.map +1 -0
  76. package/dist/src/random/random.test.d.ts +2 -0
  77. package/dist/src/random/random.test.d.ts.map +1 -0
  78. package/dist/src/random/random.test.js +36 -0
  79. package/dist/src/random/random.test.js.map +1 -0
  80. package/dist/src/storage/local-storage.test.d.ts +2 -0
  81. package/dist/src/storage/local-storage.test.d.ts.map +1 -0
  82. package/dist/src/storage/local-storage.test.js +105 -0
  83. package/dist/src/storage/local-storage.test.js.map +1 -0
  84. package/dist/src/test/assert.d.ts +5 -0
  85. package/dist/src/test/assert.d.ts.map +1 -0
  86. package/dist/src/test/assert.js +6 -0
  87. package/dist/src/test/assert.js.map +1 -0
  88. package/dist/src/test/device-pixel-ratio-mock.d.ts +6 -0
  89. package/dist/src/test/device-pixel-ratio-mock.d.ts.map +1 -0
  90. package/dist/src/test/device-pixel-ratio-mock.js +10 -0
  91. package/dist/src/test/device-pixel-ratio-mock.js.map +1 -0
  92. package/dist/src/test/index.d.ts +5 -0
  93. package/dist/src/test/index.d.ts.map +1 -0
  94. package/dist/src/test/index.js +5 -0
  95. package/dist/src/test/index.js.map +1 -0
  96. package/dist/src/test/navigator-gamepads-mock.d.ts +7 -0
  97. package/dist/src/test/navigator-gamepads-mock.d.ts.map +1 -0
  98. package/dist/src/test/navigator-gamepads-mock.js +14 -0
  99. package/dist/src/test/navigator-gamepads-mock.js.map +1 -0
  100. package/dist/src/test/secure-context-mock.d.ts +6 -0
  101. package/dist/src/test/secure-context-mock.d.ts.map +1 -0
  102. package/dist/src/test/secure-context-mock.js +10 -0
  103. package/dist/src/test/secure-context-mock.js.map +1 -0
  104. package/dist/src/test/test-element.d.ts +2 -0
  105. package/dist/src/test/test-element.d.ts.map +1 -0
  106. package/dist/src/test/test-element.js +8 -0
  107. package/dist/src/test/test-element.js.map +1 -0
  108. package/dist/src/test/test-event.d.ts +17 -0
  109. package/dist/src/test/test-event.d.ts.map +1 -0
  110. package/dist/src/test/test-event.js +26 -0
  111. package/dist/src/test/test-event.js.map +1 -0
  112. package/dist/src/test/tsconfig.json +30 -0
  113. package/dist/src/text/text-layout.test.d.ts +2 -0
  114. package/dist/src/text/text-layout.test.d.ts.map +1 -0
  115. package/dist/src/text/text-layout.test.js +717 -0
  116. package/dist/src/text/text-layout.test.js.map +1 -0
  117. package/dist/src/tsconfig.json +3 -3
  118. package/dist/src/types/geo.test.d.ts +2 -0
  119. package/dist/src/types/geo.test.d.ts.map +1 -0
  120. package/dist/src/types/geo.test.js +657 -0
  121. package/dist/src/types/geo.test.js.map +1 -0
  122. package/dist/src/types/time.test.d.ts +2 -0
  123. package/dist/src/types/time.test.d.ts.map +1 -0
  124. package/dist/src/types/time.test.js +27 -0
  125. package/dist/src/types/time.test.js.map +1 -0
  126. package/dist/src/utils/async-util.test.d.ts +2 -0
  127. package/dist/src/utils/async-util.test.d.ts.map +1 -0
  128. package/dist/src/utils/async-util.test.js +55 -0
  129. package/dist/src/utils/async-util.test.js.map +1 -0
  130. package/dist/src/utils/color-util.test.d.ts +2 -0
  131. package/dist/src/utils/color-util.test.d.ts.map +1 -0
  132. package/dist/src/utils/color-util.test.js +20 -0
  133. package/dist/src/utils/color-util.test.js.map +1 -0
  134. package/dist/src/utils/debug.test.d.ts +2 -0
  135. package/dist/src/utils/debug.test.d.ts.map +1 -0
  136. package/dist/src/utils/debug.test.js +61 -0
  137. package/dist/src/utils/debug.test.js.map +1 -0
  138. package/dist/src/utils/delay-interval.test.d.ts +2 -0
  139. package/dist/src/utils/delay-interval.test.d.ts.map +1 -0
  140. package/dist/src/utils/delay-interval.test.js +91 -0
  141. package/dist/src/utils/delay-interval.test.js.map +1 -0
  142. package/dist/src/utils/math.test.d.ts +2 -0
  143. package/dist/src/utils/math.test.d.ts.map +1 -0
  144. package/dist/src/utils/math.test.js +10 -0
  145. package/dist/src/utils/math.test.js.map +1 -0
  146. package/dist/src/utils/str-util.test.d.ts +2 -0
  147. package/dist/src/utils/str-util.test.d.ts.map +1 -0
  148. package/dist/src/utils/str-util.test.js +13 -0
  149. package/dist/src/utils/str-util.test.js.map +1 -0
  150. package/dist/tools/atlas-pack/atlas-json-parser.test.d.ts +2 -0
  151. package/dist/tools/atlas-pack/atlas-json-parser.test.d.ts.map +1 -0
  152. package/dist/tools/atlas-pack/atlas-json-parser.test.js +2109 -0
  153. package/dist/tools/atlas-pack/atlas-json-parser.test.js.map +1 -0
  154. package/dist/tools/atlas-pack/atlas.test.aseprite.json +4499 -0
  155. package/dist/tools/bundle/bundle.js +1 -1
  156. package/dist/tools/types/config-file.test.d.ts +2 -0
  157. package/dist/tools/types/config-file.test.d.ts.map +1 -0
  158. package/dist/tools/types/config-file.test.js +68 -0
  159. package/dist/tools/types/config-file.test.js.map +1 -0
  160. package/dist/tools/types/config.test.d.ts +2 -0
  161. package/dist/tools/types/config.test.d.ts.map +1 -0
  162. package/dist/tools/types/config.test.js +125 -0
  163. package/dist/tools/types/config.test.js.map +1 -0
  164. package/dist/tools/utils/argv.test.d.ts +9 -0
  165. package/dist/tools/utils/argv.test.d.ts.map +1 -0
  166. package/dist/tools/utils/argv.test.js +42 -0
  167. package/dist/tools/utils/argv.test.js.map +1 -0
  168. package/package.json +7 -3
@@ -0,0 +1,717 @@
1
+ import test, { describe } from 'node:test';
2
+ import { assert } from "../test/assert.js";
3
+ import memProp5x6 from './mem-prop-5x6.json' with { type: 'json' };
4
+ import { layoutText, layoutWord } from "./text-layout.js";
5
+ const font = memProp5x6;
6
+ const maxW = 8191;
7
+ describe('layoutText()', () => {
8
+ const cases = [
9
+ [
10
+ '',
11
+ maxW,
12
+ {
13
+ chars: [],
14
+ cursor: { x: 0, y: 0 * font.lineH },
15
+ w: 0,
16
+ h: 7,
17
+ trimmedH: 0
18
+ }
19
+ ],
20
+ [
21
+ ' ',
22
+ maxW,
23
+ {
24
+ chars: [undefined],
25
+ cursor: { x: 4, y: 0 * font.lineH },
26
+ w: 0,
27
+ h: 7,
28
+ trimmedH: 5
29
+ }
30
+ ],
31
+ [
32
+ '\n',
33
+ maxW,
34
+ {
35
+ chars: [undefined],
36
+ cursor: { x: 0, y: 1 * font.lineH },
37
+ w: 0,
38
+ h: 14,
39
+ trimmedH: 7
40
+ }
41
+ ],
42
+ [
43
+ 'abc def ghi jkl mno',
44
+ maxW,
45
+ {
46
+ chars: [
47
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
48
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
49
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
50
+ undefined,
51
+ { x: 13, y: 0 * font.lineH, w: 3, h: font.cellH },
52
+ { x: 17, y: 0 * font.lineH, w: 3, h: font.cellH },
53
+ { x: 21, y: 0 * font.lineH, w: 3, h: font.cellH },
54
+ undefined,
55
+ { x: 26, y: 0 * font.lineH, w: 3, h: font.cellH },
56
+ { x: 30, y: 0 * font.lineH, w: 3, h: font.cellH },
57
+ { x: 34, y: 0 * font.lineH, w: 1, h: font.cellH },
58
+ undefined,
59
+ { x: 37, y: 0 * font.lineH, w: 3, h: font.cellH },
60
+ { x: 41, y: 0 * font.lineH, w: 3, h: font.cellH },
61
+ { x: 45, y: 0 * font.lineH, w: 1, h: font.cellH },
62
+ undefined,
63
+ { x: 48, y: 0 * font.lineH, w: 5, h: font.cellH },
64
+ { x: 54, y: 0 * font.lineH, w: 3, h: font.cellH },
65
+ { x: 58, y: 0 * font.lineH, w: 3, h: font.cellH }
66
+ ],
67
+ cursor: { x: 61, y: 0 * font.lineH },
68
+ w: 61,
69
+ h: 7,
70
+ trimmedH: 6
71
+ }
72
+ ],
73
+ [
74
+ 'abc def ghi jkl mno',
75
+ 10,
76
+ {
77
+ chars: [
78
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
79
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
80
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
81
+ undefined,
82
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
83
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
84
+ { x: 8, y: 1 * font.lineH, w: 3, h: font.cellH },
85
+ undefined,
86
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
87
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
88
+ { x: 8, y: 2 * font.lineH, w: 1, h: font.cellH },
89
+ undefined,
90
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
91
+ { x: 4, y: 3 * font.lineH, w: 3, h: font.cellH },
92
+ { x: 8, y: 3 * font.lineH, w: 1, h: font.cellH },
93
+ undefined,
94
+ { x: 0, y: 4 * font.lineH, w: 5, h: font.cellH },
95
+ { x: 6, y: 4 * font.lineH, w: 3, h: font.cellH },
96
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH }
97
+ ],
98
+ cursor: { x: 3, y: 5 * font.lineH },
99
+ w: 10,
100
+ h: 42,
101
+ trimmedH: 40
102
+ }
103
+ ],
104
+ [
105
+ 'abc def ghi jkl mno',
106
+ 20,
107
+ {
108
+ chars: [
109
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
110
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
111
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
112
+ undefined,
113
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
114
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
115
+ { x: 8, y: 1 * font.lineH, w: 3, h: font.cellH },
116
+ undefined,
117
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
118
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
119
+ { x: 8, y: 2 * font.lineH, w: 1, h: font.cellH },
120
+ undefined,
121
+ { x: 11, y: 2 * font.lineH, w: 3, h: font.cellH },
122
+ { x: 15, y: 2 * font.lineH, w: 3, h: font.cellH },
123
+ { x: 19, y: 2 * font.lineH, w: 1, h: font.cellH },
124
+ undefined,
125
+ { x: 0, y: 3 * font.lineH, w: 5, h: font.cellH },
126
+ { x: 6, y: 3 * font.lineH, w: 3, h: font.cellH },
127
+ { x: 10, y: 3 * font.lineH, w: 3, h: font.cellH }
128
+ ],
129
+ cursor: { x: 13, y: 3 * font.lineH },
130
+ w: 19,
131
+ h: 28,
132
+ trimmedH: 26
133
+ }
134
+ ],
135
+ [
136
+ 'abc def ghi jkl mno',
137
+ 21,
138
+ {
139
+ chars: [
140
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
141
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
142
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
143
+ undefined,
144
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
145
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
146
+ { x: 8, y: 1 * font.lineH, w: 3, h: font.cellH },
147
+ undefined,
148
+ { x: 13, y: 1 * font.lineH, w: 3, h: font.cellH },
149
+ { x: 17, y: 1 * font.lineH, w: 3, h: font.cellH },
150
+ { x: 21, y: 1 * font.lineH, w: 1, h: font.cellH },
151
+ undefined,
152
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
153
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
154
+ { x: 8, y: 2 * font.lineH, w: 1, h: font.cellH },
155
+ undefined,
156
+ { x: 0, y: 3 * font.lineH, w: 5, h: font.cellH },
157
+ { x: 6, y: 3 * font.lineH, w: 3, h: font.cellH },
158
+ { x: 10, y: 3 * font.lineH, w: 3, h: font.cellH }
159
+ ],
160
+ cursor: { x: 13, y: 3 * font.lineH },
161
+ w: 21,
162
+ h: 28,
163
+ trimmedH: 27
164
+ }
165
+ ],
166
+ [
167
+ 'a b',
168
+ 4,
169
+ {
170
+ chars: [
171
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
172
+ undefined,
173
+ undefined,
174
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH }
175
+ ],
176
+ cursor: { x: 3, y: 2 * font.lineH },
177
+ w: 3,
178
+ h: 21,
179
+ trimmedH: 19
180
+ }
181
+ ],
182
+ [
183
+ 'a b ',
184
+ 4,
185
+ {
186
+ chars: [
187
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
188
+ undefined,
189
+ undefined,
190
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
191
+ undefined
192
+ ],
193
+ cursor: { x: 0, y: 3 * font.lineH },
194
+ w: 2,
195
+ h: 28,
196
+ trimmedH: 26
197
+ }
198
+ ],
199
+ [
200
+ 'a\n',
201
+ 3,
202
+ {
203
+ chars: [{ x: 0, y: 0 * font.lineH, w: 3, h: font.cellH }, undefined],
204
+ cursor: { x: 0, y: 1 * font.lineH },
205
+ w: 3,
206
+ h: 14,
207
+ trimmedH: 7
208
+ }
209
+ ]
210
+ ];
211
+ for (const [i, [str, w, expected]] of cases.entries()) {
212
+ test(`Case ${i}: str="${str}" w=${w}.`, () => assert(layoutText({ font, text: str, maxW: w }), expected));
213
+ }
214
+ });
215
+ describe('layoutWord()', () => {
216
+ const cases = [
217
+ [
218
+ { x: 0, y: 0 * font.lineH },
219
+ maxW,
220
+ ' ',
221
+ 0,
222
+ { chars: [], cursor: { x: 0, y: 0 * font.lineH }, trimmedLineH: 0, w: 0 }
223
+ ],
224
+ [
225
+ { x: 0, y: 0 * font.lineH },
226
+ maxW,
227
+ '',
228
+ 0,
229
+ { chars: [], cursor: { x: 0, y: 0 * font.lineH }, trimmedLineH: 0, w: 0 }
230
+ ],
231
+ [
232
+ { x: 0, y: 0 * font.lineH },
233
+ maxW,
234
+ '\n',
235
+ 0,
236
+ { chars: [], cursor: { x: 0, y: 0 * font.lineH }, trimmedLineH: 0, w: 0 }
237
+ ],
238
+ [
239
+ { x: 0, y: 0 * font.lineH },
240
+ maxW,
241
+ 'a',
242
+ 0,
243
+ {
244
+ chars: [{ x: 0, y: 0 * font.lineH, w: 3, h: font.cellH }],
245
+ cursor: { x: 3, y: 0 * font.lineH },
246
+ trimmedLineH: 5,
247
+ w: 3
248
+ }
249
+ ],
250
+ [
251
+ { x: 0, y: 0 * font.lineH },
252
+ maxW,
253
+ '.',
254
+ 0,
255
+ {
256
+ chars: [{ x: 0, y: 0 * font.lineH, w: 1, h: font.cellH }],
257
+ cursor: { x: 1, y: 0 * font.lineH },
258
+ trimmedLineH: 5,
259
+ w: 1
260
+ }
261
+ ],
262
+ [
263
+ { x: 0, y: 0 * font.lineH },
264
+ maxW,
265
+ 'a ',
266
+ 0,
267
+ {
268
+ chars: [{ x: 0, y: 0 * font.lineH, w: 3, h: font.cellH }],
269
+ cursor: { x: 2, y: 0 * font.lineH },
270
+ trimmedLineH: 5,
271
+ w: 2
272
+ }
273
+ ],
274
+ [
275
+ { x: 0, y: 0 * font.lineH },
276
+ maxW,
277
+ 'a\n',
278
+ 0,
279
+ {
280
+ chars: [{ x: 0, y: 0 * font.lineH, w: 3, h: font.cellH }],
281
+ cursor: { x: 3, y: 0 * font.lineH },
282
+ trimmedLineH: 5,
283
+ w: 3
284
+ }
285
+ ],
286
+ [
287
+ { x: 0, y: 0 * font.lineH },
288
+ maxW,
289
+ 'a a',
290
+ 0,
291
+ {
292
+ chars: [{ x: 0, y: 0 * font.lineH, w: 3, h: font.cellH }],
293
+ cursor: { x: 2, y: 0 * font.lineH },
294
+ trimmedLineH: 5,
295
+ w: 2
296
+ }
297
+ ],
298
+ [
299
+ { x: 0, y: 0 * font.lineH },
300
+ maxW,
301
+ 'a.',
302
+ 0,
303
+ {
304
+ chars: [
305
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
306
+ { x: 4, y: 0 * font.lineH, w: 1, h: font.cellH }
307
+ ],
308
+ cursor: { x: 5, y: 0 * font.lineH },
309
+ trimmedLineH: 5,
310
+ w: 5
311
+ }
312
+ ],
313
+ [
314
+ { x: 0, y: 0 * font.lineH },
315
+ maxW,
316
+ 'aa',
317
+ 0,
318
+ {
319
+ chars: [
320
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
321
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH }
322
+ ],
323
+ cursor: { x: 7, y: 0 * font.lineH },
324
+ trimmedLineH: 5,
325
+ w: 7
326
+ }
327
+ ],
328
+ [
329
+ { x: 0, y: 0 * font.lineH },
330
+ maxW,
331
+ 'aa\n',
332
+ 0,
333
+ {
334
+ chars: [
335
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
336
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH }
337
+ ],
338
+ cursor: { x: 7, y: 0 * font.lineH },
339
+ trimmedLineH: 5,
340
+ w: 7
341
+ }
342
+ ],
343
+ [
344
+ { x: 0, y: 0 * font.lineH },
345
+ maxW,
346
+ 'aa aa',
347
+ 0,
348
+ {
349
+ chars: [
350
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
351
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH }
352
+ ],
353
+ cursor: { x: 6, y: 0 * font.lineH },
354
+ trimmedLineH: 5,
355
+ w: 6
356
+ }
357
+ ],
358
+ [
359
+ { x: 0, y: 0 * font.lineH },
360
+ maxW,
361
+ 'g',
362
+ 0,
363
+ {
364
+ chars: [{ x: 0, y: 0 * font.lineH, w: 3, h: font.cellH }],
365
+ cursor: { x: 3, y: 0 * font.lineH },
366
+ trimmedLineH: 6,
367
+ w: 3
368
+ }
369
+ ],
370
+ [
371
+ { x: 0, y: 0 * font.lineH },
372
+ maxW,
373
+ 'abcdefgh',
374
+ 0,
375
+ {
376
+ chars: [
377
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
378
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
379
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
380
+ { x: 12, y: 0 * font.lineH, w: 3, h: font.cellH },
381
+ { x: 16, y: 0 * font.lineH, w: 3, h: font.cellH },
382
+ { x: 20, y: 0 * font.lineH, w: 3, h: font.cellH },
383
+ { x: 24, y: 0 * font.lineH, w: 3, h: font.cellH },
384
+ { x: 28, y: 0 * font.lineH, w: 3, h: font.cellH }
385
+ ],
386
+ cursor: { x: 31, y: 0 * font.lineH },
387
+ trimmedLineH: 6,
388
+ w: 31
389
+ }
390
+ ],
391
+ [
392
+ { x: 0, y: 0 * font.lineH },
393
+ maxW,
394
+ 'abcdefgh',
395
+ 1,
396
+ {
397
+ chars: [
398
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
399
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
400
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
401
+ { x: 12, y: 0 * font.lineH, w: 3, h: font.cellH },
402
+ { x: 16, y: 0 * font.lineH, w: 3, h: font.cellH },
403
+ { x: 20, y: 0 * font.lineH, w: 3, h: font.cellH },
404
+ { x: 24, y: 0 * font.lineH, w: 3, h: font.cellH }
405
+ ],
406
+ cursor: { x: 27, y: 0 * font.lineH },
407
+ trimmedLineH: 6,
408
+ w: 27
409
+ }
410
+ ],
411
+ [
412
+ { x: 0, y: 0 * font.lineH },
413
+ maxW,
414
+ 'abcdefgh',
415
+ 8,
416
+ { chars: [], cursor: { x: 0, y: 0 * font.lineH }, trimmedLineH: 0, w: 0 }
417
+ ],
418
+ [
419
+ { x: 0, y: 0 * font.lineH },
420
+ 0,
421
+ 'abcdefgh',
422
+ 0,
423
+ {
424
+ chars: [
425
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
426
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
427
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
428
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
429
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
430
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
431
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
432
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH }
433
+ ],
434
+ cursor: { x: 3, y: 7 * font.lineH },
435
+ trimmedLineH: 5,
436
+ w: 4
437
+ }
438
+ ],
439
+ [
440
+ { x: 0, y: 0 * font.lineH },
441
+ 1,
442
+ 'abcdefgh',
443
+ 0,
444
+ {
445
+ chars: [
446
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
447
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
448
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
449
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
450
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
451
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
452
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
453
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH }
454
+ ],
455
+ cursor: { x: 3, y: 7 * font.lineH },
456
+ trimmedLineH: 5,
457
+ w: 4
458
+ }
459
+ ],
460
+ [
461
+ { x: 0, y: 0 * font.lineH },
462
+ 3,
463
+ 'abcdefgh',
464
+ 0,
465
+ {
466
+ chars: [
467
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
468
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
469
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
470
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
471
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
472
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
473
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
474
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH }
475
+ ],
476
+ cursor: { x: 3, y: 7 * font.lineH },
477
+ trimmedLineH: 5,
478
+ w: 4
479
+ }
480
+ ],
481
+ [
482
+ { x: 0, y: 0 * font.lineH },
483
+ 5,
484
+ 'abcdefgh',
485
+ 0,
486
+ {
487
+ chars: [
488
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
489
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
490
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
491
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
492
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
493
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
494
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
495
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH }
496
+ ],
497
+ cursor: { x: 3, y: 7 * font.lineH },
498
+ trimmedLineH: 5,
499
+ w: 4
500
+ }
501
+ ],
502
+ [
503
+ { x: 0, y: 0 * font.lineH },
504
+ 6,
505
+ 'abcdefgh',
506
+ 0,
507
+ {
508
+ chars: [
509
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
510
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
511
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
512
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
513
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
514
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
515
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
516
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH }
517
+ ],
518
+ cursor: { x: 3, y: 7 * font.lineH },
519
+ trimmedLineH: 5,
520
+ w: 4
521
+ }
522
+ ],
523
+ [
524
+ { x: 0, y: 0 * font.lineH },
525
+ 7,
526
+ 'abcdefgh',
527
+ 0,
528
+ {
529
+ chars: [
530
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
531
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
532
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
533
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
534
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
535
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
536
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
537
+ { x: 4, y: 6 * font.lineH, w: 3, h: font.cellH }
538
+ ],
539
+ cursor: { x: 7, y: 6 * font.lineH },
540
+ trimmedLineH: 6,
541
+ w: 7
542
+ }
543
+ ],
544
+ [
545
+ { x: 0, y: 0 * font.lineH },
546
+ 8,
547
+ 'abcdefgh',
548
+ 0,
549
+ {
550
+ chars: [
551
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
552
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
553
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
554
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
555
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
556
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
557
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
558
+ { x: 4, y: 3 * font.lineH, w: 3, h: font.cellH }
559
+ ],
560
+ cursor: { x: 7, y: 3 * font.lineH },
561
+ trimmedLineH: 6,
562
+ w: 8
563
+ }
564
+ ],
565
+ [
566
+ { x: 0, y: 0 * font.lineH },
567
+ 9,
568
+ 'abcdefgh',
569
+ 0,
570
+ {
571
+ chars: [
572
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
573
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
574
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
575
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
576
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
577
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
578
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
579
+ { x: 4, y: 3 * font.lineH, w: 3, h: font.cellH }
580
+ ],
581
+ cursor: { x: 7, y: 3 * font.lineH },
582
+ trimmedLineH: 6,
583
+ w: 8
584
+ }
585
+ ],
586
+ [
587
+ { x: 0, y: 0 * font.lineH },
588
+ 10,
589
+ 'abcdefgh',
590
+ 0,
591
+ {
592
+ chars: [
593
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
594
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
595
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
596
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
597
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
598
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
599
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
600
+ { x: 4, y: 3 * font.lineH, w: 3, h: font.cellH }
601
+ ],
602
+ cursor: { x: 7, y: 3 * font.lineH },
603
+ trimmedLineH: 6,
604
+ w: 8
605
+ }
606
+ ],
607
+ [
608
+ { x: 0, y: 0 * font.lineH },
609
+ 11,
610
+ 'abcdefgh',
611
+ 0,
612
+ {
613
+ chars: [
614
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
615
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
616
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
617
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
618
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
619
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH },
620
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
621
+ { x: 4, y: 3 * font.lineH, w: 3, h: font.cellH }
622
+ ],
623
+ cursor: { x: 7, y: 3 * font.lineH },
624
+ trimmedLineH: 6,
625
+ w: 8
626
+ }
627
+ ],
628
+ [
629
+ { x: 0, y: 0 * font.lineH },
630
+ 12,
631
+ 'abcdefgh',
632
+ 0,
633
+ {
634
+ chars: [
635
+ { x: 0, y: 0 * font.lineH, w: 3, h: font.cellH },
636
+ { x: 4, y: 0 * font.lineH, w: 3, h: font.cellH },
637
+ { x: 8, y: 0 * font.lineH, w: 3, h: font.cellH },
638
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
639
+ { x: 4, y: 1 * font.lineH, w: 3, h: font.cellH },
640
+ { x: 8, y: 1 * font.lineH, w: 3, h: font.cellH },
641
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
642
+ { x: 4, y: 2 * font.lineH, w: 3, h: font.cellH }
643
+ ],
644
+ cursor: { x: 7, y: 2 * font.lineH },
645
+ trimmedLineH: 6,
646
+ w: 12
647
+ }
648
+ ],
649
+ [
650
+ { x: 1, y: 0 * font.lineH },
651
+ 5,
652
+ 'abcdefgh',
653
+ 0,
654
+ {
655
+ chars: [
656
+ { x: 1, y: 0 * font.lineH, w: 3, h: font.cellH },
657
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
658
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
659
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
660
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
661
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
662
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
663
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH }
664
+ ],
665
+ cursor: { x: 3, y: 7 * font.lineH },
666
+ trimmedLineH: 5,
667
+ w: 5
668
+ }
669
+ ],
670
+ [
671
+ { x: 2, y: 0 * font.lineH },
672
+ 5,
673
+ 'abcdefgh',
674
+ 0,
675
+ {
676
+ chars: [
677
+ { x: 0, y: 1 * font.lineH, w: 3, h: font.cellH },
678
+ { x: 0, y: 2 * font.lineH, w: 3, h: font.cellH },
679
+ { x: 0, y: 3 * font.lineH, w: 3, h: font.cellH },
680
+ { x: 0, y: 4 * font.lineH, w: 3, h: font.cellH },
681
+ { x: 0, y: 5 * font.lineH, w: 3, h: font.cellH },
682
+ { x: 0, y: 6 * font.lineH, w: 3, h: font.cellH },
683
+ { x: 0, y: 7 * font.lineH, w: 3, h: font.cellH },
684
+ { x: 0, y: 8 * font.lineH, w: 3, h: font.cellH }
685
+ ],
686
+ cursor: { x: 3, y: 8 * font.lineH },
687
+ trimmedLineH: 5,
688
+ w: 4
689
+ }
690
+ ],
691
+ [
692
+ { x: 2, y: 1 + 0 * font.lineH },
693
+ 5,
694
+ 'abcdefgh',
695
+ 0,
696
+ {
697
+ chars: [
698
+ { x: 0, y: 1 + 1 * font.lineH, w: 3, h: font.cellH },
699
+ { x: 0, y: 1 + 2 * font.lineH, w: 3, h: font.cellH },
700
+ { x: 0, y: 1 + 3 * font.lineH, w: 3, h: font.cellH },
701
+ { x: 0, y: 1 + 4 * font.lineH, w: 3, h: font.cellH },
702
+ { x: 0, y: 1 + 5 * font.lineH, w: 3, h: font.cellH },
703
+ { x: 0, y: 1 + 6 * font.lineH, w: 3, h: font.cellH },
704
+ { x: 0, y: 1 + 7 * font.lineH, w: 3, h: font.cellH },
705
+ { x: 0, y: 1 + 8 * font.lineH, w: 3, h: font.cellH }
706
+ ],
707
+ cursor: { x: 3, y: 1 + 8 * font.lineH },
708
+ trimmedLineH: 5,
709
+ w: 4
710
+ }
711
+ ]
712
+ ];
713
+ for (const [i, [xy, maxW, string, index, expected]] of cases.entries()) {
714
+ test(`case ${i}: xy=(${xy.x}, ${xy.y}), maxW=${maxW}, string="${string}", index=${index}.`, () => assert(layoutWord(font, xy, maxW, string, index, 0, 1, 0, 0), expected));
715
+ }
716
+ });
717
+ //# sourceMappingURL=text-layout.test.js.map