[Libreoffice-commits] core.git: sw/qa

Michael Stahl mstahl at redhat.com
Tue Jan 20 13:51:28 PST 2015


 sw/qa/core/uwriter.cxx |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

New commits:
commit 60143f4f7bc50054dcef923218b8c7c3bc154933
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jan 20 22:35:45 2015 +0100

    sw: add unit test for 5c363cf3f1d75e37835a6663a96b4e22c754c4cb
    
    Change-Id: If83f4900fcecde07f75d88c7f0b7c9088974b093

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 9d52233..96d2a34 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -51,6 +51,8 @@
 #include "swtypes.hxx"
 #include "fmtftn.hxx"
 #include "fmtrfmrk.hxx"
+#include <fmtinfmt.hxx>
+#include <fchrfmt.hxx>
 #include "fmtfld.hxx"
 #include "redline.hxx"
 #include "docary.hxx"
@@ -98,6 +100,7 @@ public:
     void testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode2();
     void testSwScanner();
     void testUserPerceivedCharCount();
+    void testMergePortionsDeleteNotSorted();
     void testGraphicAnchorDeletion();
     void testTransliterate();
     void testMarkMove();
@@ -127,6 +130,7 @@ public:
     CPPUNIT_TEST(testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode2);
     CPPUNIT_TEST(testSwScanner);
     CPPUNIT_TEST(testUserPerceivedCharCount);
+    CPPUNIT_TEST(testMergePortionsDeleteNotSorted);
     CPPUNIT_TEST(testGraphicAnchorDeletion);
     CPPUNIT_TEST(testMarkMove);
     CPPUNIT_TEST(testIntrusiveRing);
@@ -904,6 +908,34 @@ void SwDocTest::testSwScanner()
     }
 }
 
+void SwDocTest::testMergePortionsDeleteNotSorted()
+{
+    SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1);
+    SwPaM aPaM(aIdx);
+    m_pDoc->getIDocumentContentOperations().InsertString(aPaM, OUString("  AABBCC"));
+
+    SwCharFmt *const pCharFmt(m_pDoc->MakeCharFmt("foo", 0));
+    SwFmtCharFmt const charFmt(pCharFmt);
+
+    SwFmtINetFmt const inetFmt("http://example.com", "");
+
+    IDocumentContentOperations & rIDCO(m_pDoc->getIDocumentContentOperations());
+    aPaM.SetMark();
+    aPaM.GetPoint()->nContent = 2;
+    aPaM.GetMark()->nContent = 4;
+    rIDCO.InsertPoolItem(aPaM, charFmt, IDocumentContentOperations::INS_DEFAULT);
+    aPaM.GetPoint()->nContent = 2;
+    aPaM.GetMark()->nContent = 5;
+    rIDCO.InsertPoolItem(aPaM, inetFmt, IDocumentContentOperations::INS_DEFAULT);
+    aPaM.GetPoint()->nContent = 6;
+    aPaM.GetMark()->nContent = 8;
+    rIDCO.InsertPoolItem(aPaM, charFmt, IDocumentContentOperations::INS_DEFAULT);
+    aPaM.GetPoint()->nContent = 4;
+    aPaM.GetMark()->nContent = 6;
+    // this triggered an STL assert in SwpHints::MergePortions()
+    rIDCO.InsertPoolItem(aPaM, charFmt, IDocumentContentOperations::INS_DEFAULT);
+}
+
 //See https://bugs.libreoffice.org/show_bug.cgi?id=40599
 void SwDocTest::testGraphicAnchorDeletion()
 {


More information about the Libreoffice-commits mailing list