diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-04-21 17:06:46 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-04-21 17:08:12 +0200 |
commit | 7439d3ee14ea8b9e61f656ab092b8d83c72e0dc9 (patch) | |
tree | f034af2070841c153a78daeb260bfc0130415300 /tests | |
parent | 8ad2c98e9d596e44ea0a20c4412a1820a75ba1d5 (diff) |
Fix incorrect handling of leading spaces in text wrapping
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Framework/Mime.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/Framework/Mime.php b/tests/Framework/Mime.php index 1f9a8c58f..f15379e5f 100644 --- a/tests/Framework/Mime.php +++ b/tests/Framework/Mime.php @@ -142,4 +142,50 @@ class Framework_Mime extends PHPUnit_Framework_TestCase $this->assertEquals($unfolded, rcube_mime::unfold_flowed($flowed), "Test correct unfolding of quoted lines"); } + + /** + * Test wordwrap() + */ + function test_wordwrap() + { + $samples = array( + array( + array("aaaa aaaa\n aaaa"), + "aaaa aaaa\n aaaa", + ), + array( + array("123456789 123456789 123456789 123", 29), + "123456789 123456789 123456789\n123", + ), + array( + array("123456789 3456789 123456789", 29), + "123456789 3456789 123456789", + ), + array( + array("123456789 123456789 123456789 123", 29), + "123456789 123456789 123456789\n 123", + ), + array( + array("abc", 1, "\n", true), + "a\nb\nc", + ), + array( + array("ąść", 1, "\n", true, 'UTF-8'), + "ą\nś\nć", + ), + array( + array(">abc\n>def", 2, "\n", true), + ">abc\n>def", + ), + array( + array("abc def", 3, "-"), + "abc-def", + ), + ); + + foreach ($samples as $sample) { + $this->assertEquals($sample[1], call_user_func_array(array('rcube_mime', 'wordwrap'), $sample[0]), "Test text wrapping"); + } + } + } |