[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sc/qa svtools/source

Jan Holesovsky kendy at collabora.com
Fri Nov 18 14:20:01 UTC 2016


 sc/qa/unit/bugfix-test.cxx          |   13 +++++++++++++
 sc/qa/unit/data/html/tdf103960.html |binary
 svtools/source/svrtf/svparser.cxx   |    4 ++--
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit a13296cfa2b47230cbfcd701dd6d213b2f97bccf
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Nov 18 14:51:12 2016 +0100

    tdf#103960: The import of UCS2 data uses a different code path.
    
    The commit b297f7bbfed83f87398231740e910afe6ebfbb97 was too eager from this
    point of view, we shouldn't use SetSrcEncoding for UCS2 because in that case
    we end up with RTL_TEXTENCODING_DONTKNOW in eSrcEnc.
    
    (cherry picked from commit 6264205ee7f719f454585ada69be0a320ddc69cb)
    
    Change-Id: Id8bcb08aee17c8258c074b481345a2795939edc0

diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 0ea47b7..b137cf7 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -89,6 +89,7 @@ public:
     void testTdf98657();
     void testTdf88821();
     void testTdf88821_2();
+    void testTdf103960();
 
     CPPUNIT_TEST_SUITE(ScFiltersTest);
     CPPUNIT_TEST(testTdf64229);
@@ -100,6 +101,7 @@ public:
     CPPUNIT_TEST(testTdf98657);
     CPPUNIT_TEST(testTdf88821);
     CPPUNIT_TEST(testTdf88821_2);
+    CPPUNIT_TEST(testTdf103960);
     CPPUNIT_TEST_SUITE_END();
 private:
     uno::Reference<uno::XInterface> m_xCalcComponent;
@@ -269,6 +271,17 @@ void ScFiltersTest::testTdf88821_2()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testTdf103960()
+{
+    ScDocShellRef xDocSh = loadDoc("tdf103960.", FORMAT_HTML);
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    // A1 should be 'Data', not the entire content of the file
+    CPPUNIT_ASSERT_EQUAL(OStringToOUString("Data", RTL_TEXTENCODING_UTF8), rDoc.GetString(0, 0, 0));
+
+    xDocSh->DoClose();
+}
+
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "/sc/qa/unit/data" )
 {
diff --git a/sc/qa/unit/data/html/tdf103960.html b/sc/qa/unit/data/html/tdf103960.html
new file mode 100644
index 0000000..3e07ac1
Binary files /dev/null and b/sc/qa/unit/data/html/tdf103960.html differ
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 3c973f2..96b2924 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -173,13 +173,13 @@ sal_Unicode SvParser::GetNextChar()
                 {
                     if( 0xfe == c1 && 0xff == c2 )
                     {
-                        SetSrcEncoding(RTL_TEXTENCODING_UCS2);
+                        eSrcEnc = RTL_TEXTENCODING_UCS2;
                         bUCS2BSrcEnc = true;
                         bSeekBack = false;
                     }
                     else if( 0xff == c1 && 0xfe == c2 )
                     {
-                        SetSrcEncoding(RTL_TEXTENCODING_UCS2);
+                        eSrcEnc = RTL_TEXTENCODING_UCS2;
                         bUCS2BSrcEnc = false;
                         bSeekBack = false;
                     }


More information about the Libreoffice-commits mailing list