diff --git a/lib/simpletest/testmoodlelib.php b/lib/simpletest/testmoodlelib.php index 3a2bd3e001d..0142a665aa0 100644 --- a/lib/simpletest/testmoodlelib.php +++ b/lib/simpletest/testmoodlelib.php @@ -961,12 +961,23 @@ class moodlelib_test extends UnitTestCase { $this->assertEqual($text, shorten_text($text)); // 30 chars by default $this->assertEqual("Žluťoučký koníče...", shorten_text($text, 19, true)); $this->assertEqual("Žluťoučký ...", shorten_text($text, 19, false)); + // And try it with 2-less (that are, in bytes, the middle of a sequence) + $this->assertEqual("Žluťoučký koní...", shorten_text($text, 17, true)); + $this->assertEqual("Žluťoučký ...", shorten_text($text, 17, false)); $text = "
Žluťoučký koníček přeskočil potůček
"; $this->assertEqual($text, shorten_text($text, 60)); $this->assertEqual("Žluťoučký koníček ...
", shorten_text($text, 21)); $this->assertEqual("Žluťoučký koníče...
", shorten_text($text, 19, true)); $this->assertEqual("Žluťoučký ...
", shorten_text($text, 19, false)); + // And try it with 2-less (that are, in bytes, the middle of a sequence) + $this->assertEqual("Žluťoučký koní...
", shorten_text($text, 17, true)); + $this->assertEqual("Žluťoučký ...
", shorten_text($text, 17, false)); + // And try over one tag (start/end), it does proper text len + $this->assertEqual("Žluťoučký koníček př...
", shorten_text($text, 23, true)); + $this->assertEqual("Žluťoučký koníček přeskočil pot...
", shorten_text($text, 34, true)); + // And in the middle of one tag + $this->assertEqual("Žluťoučký koníček přeskočil...
", shorten_text($text, 30, true)); // Japanese $text = '言語設定言語設定abcdefghijkl'; @@ -1784,4 +1795,4 @@ class moodlelib_test extends UnitTestCase { // Reset the language $COURSE->lang = $originallang; } -} \ No newline at end of file +}