tdf#132944: sw_uiwriter: Add unittest
Change-Id: I45568da4b3dccd4e0cfe990c50217012f02540c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96590
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit c7f7bbf082806ba74eb5a608bfeabd05bf73510d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99642
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
diff --git a/sw/qa/extras/uiwriter/data3/tdf132944.odt b/sw/qa/extras/uiwriter/data3/tdf132944.odt
new file mode 100644
index 0000000..08c3562
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf132944.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index cdb1e5c..4196840 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -428,6 +428,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130685)
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132944)
{
load(DATA_DIRECTORY, "tdf132944.odt");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
CPPUNIT_ASSERT_EQUAL(1, getPages());
dispatchCommand(mxComponent, ".uno:SelectAll", {});
dispatchCommand(mxComponent, ".uno:Delete", {});
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(1, getPages());
dispatchCommand(mxComponent, ".uno:Undo", {});
Scheduler::ProcessEventsToIdle();
// Without the fix in place, the document would have had 2 pages
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
{
load(DATA_DIRECTORY, "tdf130680.odt");