From e48f8945b32ab5b67f1cdeb53a37d3d196e31e4d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 20 May 2016 05:19:01 -0400
Subject: [PATCH] Fix bug where message list columns could be in wrong order after column drag-n-drop and list sorting

---
 tests/Framework/Charset.php |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/tests/Framework/Charset.php b/tests/Framework/Charset.php
index 1fd1654..ece83aa 100644
--- a/tests/Framework/Charset.php
+++ b/tests/Framework/Charset.php
@@ -15,7 +15,8 @@
     {
         return array(
             array('', ''),
-            array("\xC1", ''),
+            array("\xC1", ""),
+            array("Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν", "Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν"),
         );
     }
 
@@ -25,6 +26,16 @@
     function test_clean($input, $output)
     {
         $this->assertEquals($output, rcube_charset::clean($input));
+    }
+
+    /**
+     * Just check for faulty byte-sequence, regardless of the actual cleaning results
+     */
+    function test_clean_2()
+    {
+        $bogus = "сим\xD0вол";
+        $this->assertRegExp('/\xD0\xD0/', $bogus);
+        $this->assertNotRegExp('/\xD0\xD0/', rcube_charset::clean($bogus));
     }
 
     /**
@@ -159,4 +170,22 @@
         $this->assertEquals($output, rcube_charset::detect($input, $fallback));
     }
 
+    /**
+     * Data for test_detect()
+     */
+    function data_detect_with_lang()
+    {
+        return array(
+            array('��ܦW��,�D�n', 'zh_TW', 'BIG-5'),
+        );
+    }
+
+    /**
+     * @dataProvider data_detect_with_lang
+     */
+    function test_detect_with_lang($input, $lang, $output)
+    {
+        $this->assertEquals($output, rcube_charset::detect($input, $output, $lang));
+    }
+
 }

--
Gitblit v1.9.1