summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Dhall <varun.dhall@studentpartner.com>2015-11-23 02:03:40 +0530
committerMichael Stahl <mstahl@redhat.com>2015-11-27 09:34:32 +0100
commit4bd0739b5b2110b428180c270f5f5f8722ff0b0b (patch)
tree306f45efbaba1475b2779b797fa05b26723629ca
parent4033537b3aa3aefe1cfc9ceba71e780f7c23eb08 (diff)
Added Test for tdf#94804 cross ref bookmarks created with wrong prefix
Change-Id: I9cc5a703ce613c3e0331da9b49fe660e31f64586 Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index c69f3306a048..efacac27a94c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -37,6 +37,8 @@
#include <unocrsr.hxx>
#include <unocrsrhelper.hxx>
#include <unotbl.hxx>
+#include <IMark.hxx>
+#include <IDocumentMarkAccess.hxx>
#include <pagedesc.hxx>
#include <postithelper.hxx>
#include <PostItMgr.hxx>
@@ -166,6 +168,7 @@ public:
void testTextTableCellNames();
void testShapeAnchorUndo();
void testDde();
+ void testTdf94804();
void testTdf89954();
void testTdf89720();
void testTdf88986();
@@ -246,6 +249,7 @@ public:
CPPUNIT_TEST(testTextTableCellNames);
CPPUNIT_TEST(testShapeAnchorUndo);
CPPUNIT_TEST(testDde);
+ CPPUNIT_TEST(testTdf94804);
CPPUNIT_TEST(testTdf89954);
CPPUNIT_TEST(testTdf89720);
CPPUNIT_TEST(testTdf88986);
@@ -2723,6 +2727,27 @@ void SwUiWriterTest::testDde()
CPPUNIT_ASSERT(xField->getString().endsWith("asdf"));
}
+void SwUiWriterTest::testTdf94804()
+{
+ //create new writer document
+ SwDoc* pDoc = createDoc();
+ //get cursor for making bookmark at a particular location
+ SwPaM* pCrsr = pDoc->GetEditShell()->GetCursor();
+ IDocumentMarkAccess* pIDMAccess(pDoc->getIDocumentMarkAccess());
+ //make first bookmark, CROSSREF_HEADING, with *empty* name
+ sw::mark::IMark* pMark1(pIDMAccess->makeMark(*pCrsr, rtl::OUString(""), IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK));
+ //get the new(autogenerated) bookmark name
+ rtl::OUString bookmark1name = pMark1->GetName();
+ //match the bookmark name, it should be like "__RefHeading__**"
+ CPPUNIT_ASSERT(bookmark1name.match("__RefHeading__"));
+ //make second bookmark, CROSSREF_NUMITEM, with *empty* name
+ sw::mark::IMark* pMark2(pIDMAccess->makeMark(*pCrsr, rtl::OUString(""), IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK));
+ //get the new(autogenerated) bookmark name
+ rtl::OUString bookmark2name = pMark2->GetName();
+ //match the bookmark name, it should be like "__RefNumPara__**"
+ CPPUNIT_ASSERT(bookmark2name.match("__RefNumPara__"));
+}
+
void SwUiWriterTest::testUnicodeNotationToggle()
{
SwDoc* pDoc = createDoc("unicodeAltX.odt");