summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-04-21 17:06:46 +0200
committerAleksander Machniak <alec@alec.pl>2013-04-21 17:06:46 +0200
commit102b08c6a23a1388c95fae00d2ff850f1fa7e2c4 (patch)
tree4c33eff47ef24ad0146f1bf327cdd8c928b5d4b3 /tests
parentf55bfe096dd5f90ba93590dbc6d2832ebe1c3941 (diff)
Fix incorrect handling of leading spaces in text wrapping
Diffstat (limited to 'tests')
-rw-r--r--tests/Framework/Mime.php46
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");
+ }
+ }
+
}