Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1a11ea3
Conversion of Segments to legacy Windows API calls
darrenburns Mar 1, 2022
fe57132
Add None windll definition for mypy
darrenburns Mar 1, 2022
ffc5813
Attempting to appease mypy on non-Windows platforms
darrenburns Mar 1, 2022
fb227b8
Use type of Any for windll
darrenburns Mar 1, 2022
e384106
On legacy Windows, we sometimes still need ANSI output...
darrenburns Mar 1, 2022
78fc8d9
Only calling Windows legacy console API if Console.file is stdout
darrenburns Mar 1, 2022
1d38b45
Handling utf-8 error in check_buffer consistently across Windows & Unix
darrenburns Mar 1, 2022
6779e51
Don't default to outputting ANSI just because Console.record=True
darrenburns Mar 1, 2022
bb9ab3c
Merge branch 'master' of https://github.com/Textualize/rich into ansi…
darrenburns Mar 1, 2022
501dcbd
Add tests for LegacyWindowsTerm
darrenburns Mar 1, 2022
97d05f5
Fixing test module on non-Windows platforms
darrenburns Mar 1, 2022
7d08e0a
Fixing test module on non-Windows platforms
darrenburns Mar 1, 2022
151276b
Run legacy Windows tests on Windows only
darrenburns Mar 2, 2022
862416a
Fix typing issues
darrenburns Mar 2, 2022
7525377
Use Python 3.6 & 3.7 compatible means of acceessing mock call args/kw…
darrenburns Mar 2, 2022
80912a5
Update CHANGELOG.md
darrenburns Mar 2, 2022
28786c7
Merge branch 'ansi-to-win32' of https://github.com/Textualize/rich in…
darrenburns Mar 2, 2022
ceef724
Use Windows Console API to write text
darrenburns Mar 3, 2022
1122501
Use WriteConsoleW instead of file.write(...) in LegacyWindowsTerm
darrenburns Mar 3, 2022
d87498b
Use bitwise operators in LegacyWindowsTerm, fix formatting
darrenburns Mar 3, 2022
5a051f9
Make GetConsoleMode Windows Console wrapper more Pythonic
darrenburns Mar 3, 2022
8f738c7
Support reverse, bold (bright), and dim
darrenburns Mar 3, 2022
ca3e966
Handle legacy windows error
darrenburns Mar 3, 2022
81c4dc4
Add docstrings to Windows console wrapper functions
darrenburns Mar 3, 2022
9b76da2
Merge pull request #2019 from Textualize/ansi-to-win32_pull-request-f…
darrenburns Mar 7, 2022
8fe170a
Merge branch 'master' into ansi-to-win32
willmcgugan Mar 9, 2022
91e0146
check win32
willmcgugan Mar 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions tests/test_win32_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,14 @@ def test_write_styled(_, SetConsoleTextAttribute, win32_handle):

assert f.getvalue() == text
# Ensure we set the text attributes and then reset them after writing styled text
assert call_args[0].args == (win32_handle,)
assert call_args[0].kwargs["attributes"].value == 64
assert call_args[1] == call(win32_handle, attributes=DEFAULT_STYLE_ATTRIBUTE)

first_args, first_kwargs = call_args[0]
second_args, second_kwargs = call_args[1]

assert first_args == (win32_handle,)
assert first_kwargs["attributes"].value == 64
assert second_args == (win32_handle,)
assert second_kwargs["attributes"] == DEFAULT_STYLE_ATTRIBUTE

@patch.object(_win32_console, "FillConsoleOutputCharacter", return_value=None)
@patch.object(_win32_console, "FillConsoleOutputAttribute", return_value=None)
Expand Down Expand Up @@ -294,8 +299,10 @@ def test_hide_cursor(_, SetConsoleCursorInfo, win32_handle):
call_args = SetConsoleCursorInfo.call_args_list

assert len(call_args) == 1
assert call_args[0].kwargs["cursor_info"].bVisible == 0
assert call_args[0].kwargs["cursor_info"].dwSize == 100

args, kwargs = call_args[0]
assert kwargs["cursor_info"].bVisible == 0
assert kwargs["cursor_info"].dwSize == 100

@patch.object(_win32_console, "SetConsoleCursorInfo", return_value=None)
@patch.object(
Expand All @@ -308,8 +315,10 @@ def test_show_cursor(_, SetConsoleCursorInfo, win32_handle):
call_args = SetConsoleCursorInfo.call_args_list

assert len(call_args) == 1
assert call_args[0].kwargs["cursor_info"].bVisible == 1
assert call_args[0].kwargs["cursor_info"].dwSize == 100

args, kwargs = call_args[0]
assert kwargs["cursor_info"].bVisible == 1
assert kwargs["cursor_info"].dwSize == 100

@patch.object(_win32_console, "SetConsoleTitle", return_value=None)
def test_set_title(SetConsoleTitle):
Expand Down