summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-01-20 22:35:45 +0100
committerMichael Stahl <mstahl@redhat.com>2015-01-20 22:36:34 +0100
commit60143f4f7bc50054dcef923218b8c7c3bc154933 (patch)
treed7533a7da30e8f84066ee06629a4f81ae9b9c183 /sw
parentef9d28a3605b7e3e1e68212cc44f7379fd2f464a (diff)
sw: add unit test for 5c363cf3f1d75e37835a6663a96b4e22c754c4cb
Change-Id: If83f4900fcecde07f75d88c7f0b7c9088974b093
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/uwriter.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 9d52233a5d1d..96d2a34089ed 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()
{