[Libreoffice-commits] .: sw/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 14 06:38:30 PST 2013


 sw/qa/core/swdoc-test.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit bf670bcd5e60eae95a6bd297391799f13e55db9d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jan 14 15:23:49 2013 +0100

    fdo#57938 testcase
    
    Change-Id: I5a219011952f37861b0688e17afca1b3b07fdc31

diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
index de9828e..f2cc9cc 100644
--- a/sw/qa/core/swdoc-test.cxx
+++ b/sw/qa/core/swdoc-test.cxx
@@ -45,6 +45,8 @@
 #include <sfx2/docfile.hxx>
 #include <sfx2/sfxmodelfactory.hxx>
 
+#include <xmloff/odffields.hxx>
+
 #include "breakit.hxx"
 #include "doc.hxx"
 #include "docsh.hxx"
@@ -88,6 +90,7 @@ public:
     void testSwScanner();
     void testUserPerceivedCharCount();
     void testGraphicAnchorDeletion();
+    void testFdo57938();
 
     CPPUNIT_TEST_SUITE(SwDocTest);
     CPPUNIT_TEST(randomTest);
@@ -98,6 +101,7 @@ public:
     CPPUNIT_TEST(testSwScanner);
     CPPUNIT_TEST(testUserPerceivedCharCount);
     CPPUNIT_TEST(testGraphicAnchorDeletion);
+    CPPUNIT_TEST(testFdo57938);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -874,6 +878,24 @@ void SwDocTest::randomTest()
     }
 }
 
+void SwDocTest::testFdo57938()
+{
+    SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1);
+    SwPaM aPaM(aIdx);
+
+    // Insert "atest" and create a fieldmark around "test".
+    OUString aTest("atest");
+    m_pDoc->InsertString(aPaM, aTest);
+    aPaM.SetMark();
+    aPaM.GetPoint()->nContent = 1;
+    IDocumentMarkAccess* pMarksAccess = m_pDoc->getIDocumentMarkAccess();
+    pMarksAccess->makeFieldBookmark(aPaM, "", ODF_COMMENTRANGE);
+    aPaM.GetPoint()->nContent = 0;
+    aPaM.GetMark()->nContent = 1;
+    // The problem was that "a" was considered read-only, so could not be deleted.
+    CPPUNIT_ASSERT_EQUAL(false, bool(aPaM.HasReadonlySel(false)));
+}
+
 void SwDocTest::setUp()
 {
     BootstrapFixture::setUp();


More information about the Libreoffice-commits mailing list