Kaydet (Commit) daca28de authored tarafından Michael Stahl's avatar Michael Stahl

sw: add test that SwXTextCursor is disposed if header is deleted

This test failed for 2 reasons:
1) since somewhere between LO 5.0 and 5.1, the PaMCorrAbs sent a
   SwMsgPoolItem but SwUnoCursorPointer checked for a LegacyModifyHint
   (fixed in commit a029a479)
2) the SwXHeadFootText being registered at the header format prevented
   its deletion (fixed in preceding commit)

Change-Id: I1d36bc2b9ca222b1b68fda94ded65451a677214a
üst 99777c5a
......@@ -143,6 +143,7 @@ public:
void testBookmarkUndo();
void testFdo85876();
void testFdo87448();
void testTextCursorInvalidation();
void testTdf68183();
void testCp1000115();
void testTdf63214();
......@@ -269,6 +270,7 @@ public:
CPPUNIT_TEST(testBookmarkUndo);
CPPUNIT_TEST(testFdo85876);
CPPUNIT_TEST(testFdo87448);
CPPUNIT_TEST(testTextCursorInvalidation);
CPPUNIT_TEST(testTdf68183);
CPPUNIT_TEST(testCp1000115);
CPPUNIT_TEST(testTdf63214);
......@@ -1261,6 +1263,26 @@ void SwUiWriterTest::testFdo87448()
CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), abs(nFirstEnd - nSecondEnd) < 10);
}
void SwUiWriterTest::testTextCursorInvalidation()
{
createDoc();
SwDoc* pDoc = createDoc();
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
CPPUNIT_ASSERT(xPageStyle.is());
xPageStyle->setPropertyValue("HeaderIsOn", uno::makeAny(true));
uno::Reference<text::XText> xHeader(getProperty<uno::Reference<text::XText>>(xPageStyle, "HeaderText"));
CPPUNIT_ASSERT(xHeader.is());
// create cursor inside the header text
uno::Reference<text::XTextCursor> xCursor(xHeader->createTextCursor());
// can't go right in empty header
CPPUNIT_ASSERT(!xCursor->goRight(1, false));
// this does not actually delete the header: xPageStyle->setPropertyValue("HeaderIsOn", uno::makeAny(false));
pWrtShell->ChangeHeaderOrFooter("Default Style", true, false, false);
// must be disposed after deleting header
CPPUNIT_ASSERT_THROW(xCursor->goRight(1, false), uno::RuntimeException);
}
void SwUiWriterTest::testTdf68183()
{
// First disable RSID and check if indeed no such attribute is inserted.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment