diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-02-15 14:52:52 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-02-15 20:52:23 +0100 |
commit | 2bf59e3b60a0d5c6ebcd4498f5038d6d2e86db62 (patch) | |
tree | daccd2db7f382f40b602c0d6ee166313115db758 /sw/qa | |
parent | 4b0c17609c2cca326bbcc9e8488a327a4a9ea952 (diff) |
tdf#146848: sw_uiwriter3: Add unittest
Change-Id: I6460a99ce31cbbcba0498a6caaaac3b304a5134e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129966
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 84e65489f325..f0a76ebc97f1 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -97,6 +97,38 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139843) CPPUNIT_ASSERT_EQUAL(nPages, getPages()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146848) +{ + // Reuse existing document + createSwDoc(DATA_DIRECTORY, "tdf77014.odt"); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); + + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + CPPUNIT_ASSERT(!xFields->hasMoreElements()); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); + + xFields = xFieldsAccess->createEnumeration(); + + int nFieldsCount = 0; + while (xFields->hasMoreElements()) + { + xFields->nextElement(); + nFieldsCount++; + } + CPPUNIT_ASSERT_EQUAL(4, nFieldsCount); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145321) { createSwDoc(DATA_DIRECTORY, "tdf145321.odt"); |