Fixed a regression in reading dialog based TUI.
This commit is contained in:
@@ -148,3 +148,95 @@ class TestIncomingCommand:
|
||||
command.run()
|
||||
|
||||
output_manager.present_text.assert_not_called()
|
||||
|
||||
def test_dialog_button_paint_is_read_after_following_message(
|
||||
self, incoming_command
|
||||
):
|
||||
command, env, output_manager = incoming_command
|
||||
env["screen"]["new_content_text"] = "\n".join(
|
||||
[
|
||||
"".ljust(20),
|
||||
"< OK >".center(20),
|
||||
"".ljust(20),
|
||||
]
|
||||
)
|
||||
env["screen"]["new_delta"] = "\n".join(
|
||||
[
|
||||
" ",
|
||||
" < OK >",
|
||||
" ",
|
||||
]
|
||||
)
|
||||
|
||||
command.run()
|
||||
|
||||
output_manager.present_text.assert_not_called()
|
||||
|
||||
env["screen"]["old_content_text"] = env["screen"]["new_content_text"]
|
||||
env["screen"]["new_content_text"] = "\n".join(
|
||||
[
|
||||
"This is a test".ljust(20),
|
||||
"< OK >".center(20),
|
||||
"".ljust(20),
|
||||
]
|
||||
)
|
||||
env["screen"]["new_delta"] = "This is a test"
|
||||
|
||||
command.run()
|
||||
|
||||
output_manager.present_text.assert_called_once_with(
|
||||
"This is a test\n< OK >", interrupt=False, flush=False
|
||||
)
|
||||
|
||||
def test_single_word_output_is_not_treated_as_dialog_button(
|
||||
self, incoming_command
|
||||
):
|
||||
command, env, output_manager = incoming_command
|
||||
env["screen"]["new_content_text"] = "Ready"
|
||||
env["screen"]["new_delta"] = "Ready"
|
||||
|
||||
command.run()
|
||||
|
||||
output_manager.present_text.assert_called_once_with(
|
||||
"Ready", interrupt=False, flush=False
|
||||
)
|
||||
|
||||
def test_dialog_button_is_not_preferred_over_message(
|
||||
self, incoming_command
|
||||
):
|
||||
command, env, output_manager = incoming_command
|
||||
env["screen"]["old_content_text"] = "\n".join(
|
||||
[
|
||||
'bash-5.3$ dialog --msgbox "This is a test" -1 -1'.ljust(80),
|
||||
"".ljust(80),
|
||||
"".ljust(80),
|
||||
"".ljust(80),
|
||||
"".ljust(80),
|
||||
"".ljust(80),
|
||||
]
|
||||
)
|
||||
env["screen"]["new_content_text"] = "\n".join(
|
||||
[
|
||||
"".ljust(80),
|
||||
" This is a test".ljust(80),
|
||||
"".ljust(80),
|
||||
"".ljust(80),
|
||||
" < OK >".ljust(80),
|
||||
"".ljust(80),
|
||||
]
|
||||
)
|
||||
env["screen"]["new_delta"] = "\n".join(
|
||||
[
|
||||
" ",
|
||||
" This is a test ",
|
||||
" < OK > ",
|
||||
]
|
||||
)
|
||||
|
||||
command.run()
|
||||
|
||||
output_manager.present_text.assert_called_once_with(
|
||||
" \n This is a test \n < OK > ",
|
||||
interrupt=False,
|
||||
flush=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user