[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Aug 11 06:30:07 PDT 2015


 sw/qa/extras/uiwriter/data/tdf89954.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx      |   22 ++++++++++++++++++++++
 sw/source/core/txtnode/thints.cxx       |    2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 4eb0e4ace354df4c633aebc2f525911dd50e6f06
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 29 09:08:00 2015 +0200

    tdf#89954 sw: let annotation have CH_TXTATR_INWORD placeholder again
    
    Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792:
    complete annotations on text ranges feature, 2013-12-19), the problem
    was that while sw wanted CH_TXTATR_INWORD as a placeholder character for
    anchor positions that do not count as a word boundary, the commit
    changed GetCharOfTextAttr() so that annotations have CH_TXTATR_BREAKWORD
    as the placeholder.
    
    Fix the problem by reverting the last hunk of
    sw/source/core/txtnode/thints.cxx changes in that commit.
    
    (cherry picked from commit 89d615360e80a13fff6bc69885e5780d8fedf149)
    
    Conflicts:
    	sw/qa/extras/uiwriter/uiwriter.cxx
    
    Change-Id: Ia8c97efda9c1e90ae3c27ddb8247e3f3203a63fb
    Reviewed-on: https://gerrit.libreoffice.org/17621
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/uiwriter/data/tdf89954.odt b/sw/qa/extras/uiwriter/data/tdf89954.odt
new file mode 100644
index 0000000..538d978
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf89954.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index ed31220..1fc636c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -51,6 +51,7 @@
 #include "com/sun/star/util/SearchAlgorithms.hpp"
 #include "com/sun/star/i18n/TransliterationModulesExtra.hpp"
 #include <comphelper/propertysequence.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
 
@@ -96,6 +97,7 @@ public:
     void testTdf86639();
     void testTdf90883TableBoxGetCoordinates();
     void testDde();
+    void testTdf89954();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -134,6 +136,7 @@ public:
     CPPUNIT_TEST(testTdf86639);
     CPPUNIT_TEST(testTdf90883TableBoxGetCoordinates);
     CPPUNIT_TEST(testDde);
+    CPPUNIT_TEST(testTdf89954);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1022,6 +1025,25 @@ void SwUiWriterTest::testDde()
     CPPUNIT_ASSERT(xField->getString().endsWith("asdf"));
 }
 
+void SwUiWriterTest::testTdf89954()
+{
+    SwDoc* pDoc = createDoc("tdf89954.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->EndPara();
+    SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'e', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 's', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '.', 0);
+
+    SwNodeIndex aNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1);
+    // Placeholder character for the comment anchor was ^A (CH_TXTATR_BREAKWORD), not <fff9> (CH_TXTATR_INWORD).
+    // As a result, autocorrect did not turn the 't' input into 'T'.
+    OUString aExpected("Tes\xef\xbf\xb9t. Test.", 14, RTL_TEXTENCODING_UTF8);
+    CPPUNIT_ASSERT_EQUAL(aExpected, aNodeIndex.GetNode().GetTextNode()->GetText());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 452ae53..a3a9047 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3446,6 +3446,7 @@ sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr )
     {
         case RES_TXTATR_REFMARK:
         case RES_TXTATR_TOXMARK:
+        case RES_TXTATR_ANNOTATION:
             cRet = CH_TXTATR_INWORD;
         break;
 
@@ -3454,7 +3455,6 @@ sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr )
         case RES_TXTATR_FTN:
         case RES_TXTATR_META:
         case RES_TXTATR_METAFIELD:
-        case RES_TXTATR_ANNOTATION:
         {
             cRet = CH_TXTATR_BREAKWORD;
         }


More information about the Libreoffice-commits mailing list