tdf#126504: sw: Add unittest
Change-Id: Iceca8bc3ae2dcad04040498565200361157f83e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97613 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
c131d6c6b9
commit
6f9d03561f
2 changed files with 47 additions and 0 deletions
BIN
sw/qa/extras/uiwriter/data3/tdf126504.odt
Normal file
BIN
sw/qa/extras/uiwriter/data3/tdf126504.odt
Normal file
Binary file not shown.
|
@ -238,6 +238,53 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133990)
|
|||
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126504)
|
||||
{
|
||||
load(DATA_DIRECTORY, "tdf126504.odt");
|
||||
|
||||
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
|
||||
CPPUNIT_ASSERT(pTextDoc);
|
||||
|
||||
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
|
||||
uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
||||
|
||||
//Use selectAll 2 times in a row
|
||||
dispatchCommand(mxComponent, ".uno:SelectAll", {});
|
||||
dispatchCommand(mxComponent, ".uno:SelectAll", {});
|
||||
|
||||
dispatchCommand(mxComponent, ".uno:Copy", {});
|
||||
dispatchCommand(mxComponent, ".uno:GoToEndOfPage", {});
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
|
||||
dispatchCommand(mxComponent, ".uno:Paste", {});
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess->getCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
||||
|
||||
dispatchCommand(mxComponent, ".uno:Undo", {});
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
||||
|
||||
dispatchCommand(mxComponent, ".uno:Redo", {});
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess->getCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
||||
|
||||
//Without the fix in place, it would have crashed here
|
||||
dispatchCommand(mxComponent, ".uno:Undo", {});
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982)
|
||||
{
|
||||
load(DATA_DIRECTORY, "tdf133982.docx");
|
||||
|
|
Loading…
Reference in a new issue