aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_runview.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/test_runview.py')
-rw-r--r--app/tests/test_runview.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/tests/test_runview.py b/app/tests/test_runview.py
index 8feeee1..3f77ed0 100644
--- a/app/tests/test_runview.py
+++ b/app/tests/test_runview.py
@@ -62,10 +62,21 @@ class FormatTests(_FakeTui, unittest.TestCase):
self.assertEqual(runview._fit("hello", 3), "he~")
self.assertEqual(runview._fit("hi", 10), "hi")
+ def test_fit_truncates_wide_characters_by_display_columns(self):
+ # Japanese characters fill two terminal cells each, so fitting
+ # by character count would let lines overflow their pane.
+ self.assertEqual(runview._fit("你好", 4), "你好")
+ self.assertEqual(runview._fit("你好你好", 5), "你好~")
+ self.assertEqual(runview._fit("こんにちは", 3), "こ~")
+
def test_wrap_wraps_on_word_boundaries(self):
self.assertEqual(runview._wrap("aaaa bbbb cccc dddd", 12),
["aaaa bbbb", "cccc dddd"])
+ def test_wrap_counts_wide_characters_as_two_columns(self):
+ self.assertEqual(runview._wrap("日本語 テスト", 10),
+ ["日本語", "テスト"])
+
class StateTransitionTests(_FakeTui, unittest.TestCase):
def test_boot_flow_starting_to_ready(self):