@@ -146,14 +146,14 @@ def mock_isatty():
146
146
assert f"(303, 201) { COLORED_START } " in captured .out
147
147
assert f"(303, 228) { ON_PATH } " in captured .out
148
148
149
- assert f "(303, 266)" in captured .out
149
+ assert "(303, 266)" in captured .out
150
150
assert f"(303, 266) { ON_PATH } " not in captured .out
151
151
152
152
assert f"(233, 201) { COLORED_END } " in captured .out
153
153
154
154
assert f"(326, 54) { COLORED_START } " in captured .out
155
155
156
- assert f "(326, 91)" in captured .out
156
+ assert "(326, 91)" in captured .out
157
157
assert f"(326, 91) { ON_PATH } " not in captured .out
158
158
159
159
assert f"(264, -14) { ON_PATH } " in captured .out
@@ -180,16 +180,175 @@ def mock_isatty():
180
180
assert f"(303, 201) { UNCOLORED_START } " in captured .out
181
181
assert f"(303, 228) { ON_PATH } " in captured .out
182
182
183
- assert f "(303, 266)" in captured .out
183
+ assert "(303, 266)" in captured .out
184
184
assert f"(303, 266) { ON_PATH } " not in captured .out
185
185
186
186
assert f"(233, 201) { UNCOLORED_END } " in captured .out
187
187
188
188
assert f"(326, 54) { UNCOLORED_START } " in captured .out
189
189
190
- assert f "(326, 91)" in captured .out
190
+ assert "(326, 91)" in captured .out
191
191
assert f"(326, 91) { ON_PATH } " not in captured .out
192
192
193
193
assert f"(264, -14) { ON_PATH } " in captured .out
194
194
195
195
assert f"(326, 18) { UNCOLORED_END } " in captured .out
196
+
197
+
198
+ def test_coordinates_run_multi_glyph_default (capsys , monkeypatch ):
199
+ def mock_isatty ():
200
+ return True
201
+
202
+ # apply the monkeypatch for sys.stdout.isatty()
203
+ monkeypatch .setattr (sys .stdout , "isatty" , mock_isatty )
204
+
205
+ args = parser .parse_args ([TESTFONT_PATH_1 ])
206
+ coordinates_run (args )
207
+
208
+ captured = capsys .readouterr ()
209
+
210
+ # confirm all expected glyphs are included
211
+ assert "\x1b [1;36m'.notdef' coordinates\x1b [0m" in captured .out
212
+ assert "\x1b [1;36m'space' coordinates\x1b [0m" in captured .out
213
+ assert "\x1b [1;36m'comma' coordinates\x1b [0m" in captured .out
214
+ assert "\x1b [1;36m'question' coordinates\x1b [0m" in captured .out
215
+ assert "\x1b [1;36m'A' coordinates\x1b [0m" in captured .out
216
+ assert "\x1b [1;36m'uni2E2E' coordinates\x1b [0m" in captured .out
217
+
218
+ # check start paths across the glyphs
219
+ assert f"(185, 116) { COLORED_START } " in captured .out
220
+ assert f"(140, 201) { COLORED_START } " in captured .out
221
+ assert f"(117, 54) { COLORED_START } " in captured .out
222
+ assert f"(545, 0) { COLORED_START } " in captured .out
223
+ assert f"(432, 301) { COLORED_START } " in captured .out
224
+ assert f"(303, 201) { COLORED_START } " in captured .out
225
+ assert f"(326, 54) { COLORED_START } " in captured .out
226
+
227
+ # check end paths across the glyphs
228
+ assert f"(91, 116) { COLORED_END } " in captured .out
229
+ assert f"(210, 201) { COLORED_END } " in captured .out
230
+ assert f"(117, 18) { COLORED_END } " in captured .out
231
+ assert f"(638, 0) { COLORED_END } " in captured .out
232
+ assert f"(206, 301) { COLORED_END } " in captured .out
233
+ assert f"(233, 201) { COLORED_END } " in captured .out
234
+ assert f"(326, 18) { COLORED_END } " in captured .out
235
+
236
+ # check glyphs with no contours across the glyphs
237
+ x = 1
238
+ lines = captured .out .split ("\n " )
239
+ for line in lines :
240
+ if x == 4 or x == 9 :
241
+ assert "No contours" in line
242
+ x += 1
243
+
244
+ # spot check on-path coordinates in noncomposite glyphs
245
+ assert f"(140, 228) { ON_PATH } " in captured .out
246
+ assert f"(352, 517) { ON_PATH } " in captured .out
247
+ assert f"(240, 54) { ON_PATH } " in captured .out
248
+
249
+ # spot check off-path coordinates in noncomposite glyphs
250
+ assert f"(130, -75) { ON_PATH } " not in captured .out
251
+ assert "(130, -75)" in captured .out
252
+
253
+ assert f"(210, 246) { ON_PATH } " not in captured .out
254
+ assert "(210, 246)" in captured .out
255
+
256
+ assert f"(322, 612) { ON_PATH } " not in captured .out
257
+ assert "(322, 612)" in captured .out
258
+
259
+ assert f"(251, 370) { ON_PATH } " not in captured .out
260
+ assert "(251, 370)" in captured .out
261
+
262
+ assert f"(203, 91) { ON_PATH } " not in captured .out
263
+ assert "(203, 91)" in captured .out
264
+
265
+
266
+ def test_coordinates_run_multi_glyph_nocolor (capsys , monkeypatch ):
267
+ def mock_isatty ():
268
+ return True
269
+
270
+ # apply the monkeypatch for sys.stdout.isatty()
271
+ monkeypatch .setattr (sys .stdout , "isatty" , mock_isatty )
272
+
273
+ args = parser .parse_args (["--nocolor" , TESTFONT_PATH_1 ])
274
+ coordinates_run (args )
275
+
276
+ captured = capsys .readouterr ()
277
+
278
+ # confirm all expected glyphs are included
279
+ assert "\x1b [1;36m'.notdef' coordinates\x1b [0m" not in captured .out
280
+ assert "\x1b [1;36m'space' coordinates\x1b [0m" not in captured .out
281
+ assert "\x1b [1;36m'comma' coordinates\x1b [0m" not in captured .out
282
+ assert "\x1b [1;36m'question' coordinates\x1b [0m" not in captured .out
283
+ assert "\x1b [1;36m'A' coordinates\x1b [0m" not in captured .out
284
+ assert "\x1b [1;36m'uni2E2E' coordinates\x1b [0m" not in captured .out
285
+
286
+ assert "'.notdef' coordinates" in captured .out
287
+ assert "'space' coordinates" in captured .out
288
+ assert "'comma' coordinates" in captured .out
289
+ assert "'question' coordinates" in captured .out
290
+ assert "'A' coordinates" in captured .out
291
+ assert "'uni2E2E' coordinates" in captured .out
292
+
293
+ # check start paths across the glyphs
294
+ assert f"(185, 116) { COLORED_START } " not in captured .out
295
+ assert f"(140, 201) { COLORED_START } " not in captured .out
296
+ assert f"(117, 54) { COLORED_START } " not in captured .out
297
+ assert f"(545, 0) { COLORED_START } " not in captured .out
298
+ assert f"(432, 301) { COLORED_START } " not in captured .out
299
+ assert f"(303, 201) { COLORED_START } " not in captured .out
300
+ assert f"(326, 54) { COLORED_START } " not in captured .out
301
+
302
+ assert f"(185, 116) { UNCOLORED_START } " in captured .out
303
+ assert f"(140, 201) { UNCOLORED_START } " in captured .out
304
+ assert f"(117, 54) { UNCOLORED_START } " in captured .out
305
+ assert f"(545, 0) { UNCOLORED_START } " in captured .out
306
+ assert f"(432, 301) { UNCOLORED_START } " in captured .out
307
+ assert f"(303, 201) { UNCOLORED_START } " in captured .out
308
+ assert f"(326, 54) { UNCOLORED_START } " in captured .out
309
+
310
+ # check end paths across the glyphs
311
+ assert f"(91, 116) { COLORED_END } " not in captured .out
312
+ assert f"(210, 201) { COLORED_END } " not in captured .out
313
+ assert f"(117, 18) { COLORED_END } " not in captured .out
314
+ assert f"(638, 0) { COLORED_END } " not in captured .out
315
+ assert f"(206, 301) { COLORED_END } " not in captured .out
316
+ assert f"(233, 201) { COLORED_END } " not in captured .out
317
+ assert f"(326, 18) { COLORED_END } " not in captured .out
318
+
319
+ assert f"(91, 116) { UNCOLORED_END } " in captured .out
320
+ assert f"(210, 201) { UNCOLORED_END } " in captured .out
321
+ assert f"(117, 18) { UNCOLORED_END } " in captured .out
322
+ assert f"(638, 0) { UNCOLORED_END } " in captured .out
323
+ assert f"(206, 301) { UNCOLORED_END } " in captured .out
324
+ assert f"(233, 201) { UNCOLORED_END } " in captured .out
325
+ assert f"(326, 18) { UNCOLORED_END } " in captured .out
326
+
327
+ # check glyphs with no contours across the glyphs
328
+ x = 1
329
+ lines = captured .out .split ("\n " )
330
+ for line in lines :
331
+ if x == 4 or x == 9 :
332
+ assert "No contours" in line
333
+ x += 1
334
+
335
+ # spot check on-path coordinates in noncomposite glyphs
336
+ assert f"(140, 228) { ON_PATH } " in captured .out
337
+ assert f"(352, 517) { ON_PATH } " in captured .out
338
+ assert f"(240, 54) { ON_PATH } " in captured .out
339
+
340
+ # spot check off-path coordinates in noncomposite glyphs
341
+ assert f"(130, -75) { ON_PATH } " not in captured .out
342
+ assert "(130, -75)" in captured .out
343
+
344
+ assert f"(210, 246) { ON_PATH } " not in captured .out
345
+ assert "(210, 246)" in captured .out
346
+
347
+ assert f"(322, 612) { ON_PATH } " not in captured .out
348
+ assert "(322, 612)" in captured .out
349
+
350
+ assert f"(251, 370) { ON_PATH } " not in captured .out
351
+ assert "(251, 370)" in captured .out
352
+
353
+ assert f"(203, 91) { ON_PATH } " not in captured .out
354
+ assert "(203, 91)" in captured .out
0 commit comments