Skip to content

Commit 8095c8a

Browse files
committed
add contours multi-glyph unit tests
1 parent f5dded6 commit 8095c8a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/test_contours.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,45 @@ def mock_isatty():
139139
# must be in a tty to get ANSI color output
140140
# this is mocked above
141141
assert "[ uni2E2E ]: 2" in captured.out
142+
143+
144+
def test_contours_run_multi_glyph_composite_default(capsys, monkeypatch):
145+
def mock_isatty():
146+
return True
147+
148+
# apply the monkeypatch for sys.stdout.isatty()
149+
monkeypatch.setattr(sys.stdout, "isatty", mock_isatty)
150+
151+
args = parser.parse_args([TESTFONT_PATH_1])
152+
contours_run(args)
153+
154+
captured = capsys.readouterr()
155+
# must be in a tty to get ANSI color output
156+
# this is mocked above
157+
assert "[ \x1b[1;36m.notdef\x1b[0m ]: 0" in captured.out
158+
assert "[ \x1b[1;36mspace\x1b[0m ]: 0" in captured.out
159+
assert "[ \x1b[1;36mcomma\x1b[0m ]: 1" in captured.out
160+
assert "[ \x1b[1;36mquestion\x1b[0m ]: 2" in captured.out
161+
assert "[ \x1b[1;36mA\x1b[0m ]: 2" in captured.out
162+
assert "[ \x1b[1;36muni2E2E\x1b[0m ]: 2" in captured.out
163+
164+
165+
def test_contours_run_multi_glyph_composite_nocolor(capsys, monkeypatch):
166+
def mock_isatty():
167+
return True
168+
169+
# apply the monkeypatch for sys.stdout.isatty()
170+
monkeypatch.setattr(sys.stdout, "isatty", mock_isatty)
171+
172+
args = parser.parse_args(["--nocolor", TESTFONT_PATH_1])
173+
contours_run(args)
174+
175+
captured = capsys.readouterr()
176+
# must be in a tty to get ANSI color output
177+
# this is mocked above
178+
assert "[ .notdef ]: 0" in captured.out
179+
assert "[ space ]: 0" in captured.out
180+
assert "[ comma ]: 1" in captured.out
181+
assert "[ question ]: 2" in captured.out
182+
assert "[ A ]: 2" in captured.out
183+
assert "[ uni2E2E ]: 2" in captured.out

0 commit comments

Comments
 (0)