diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-04-03 20:35:52 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-04-04 11:11:05 +0200 |
commit | a03b83c362ffa36fdae5befd04c391aa532cc46e (patch) | |
tree | aafff4c2fa131bc98c97b1ac19a03d3c08f4e45d /sw | |
parent | 0050759cb9cf8ac337c0ecec48c009501de9fb0f (diff) |
tdf#87199: move UItest to CppunitTest
Change-Id: I3a07a8e6fe6e37d55de6069082b32d84c0450177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91659
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 49e60f6bc0d9..e5e045dac1b3 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -417,4 +417,51 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf96067) CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf87199) +{ + mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence( + { { "Rows", uno::makeAny(sal_Int32(2)) }, { "Columns", uno::makeAny(sal_Int32(1)) } })); + + dispatchCommand(mxComponent, ".uno:InsertTable", aArgs); + + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTextTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getColumns()->getCount()); + + uno::Reference<text::XTextRange> xCellA1(xTextTable->getCellByName("A1"), uno::UNO_QUERY); + xCellA1->setString("test1"); + + uno::Reference<text::XTextRange> xCellA2(xTextTable->getCellByName("A2"), uno::UNO_QUERY); + xCellA2->setString("test2"); + + dispatchCommand(mxComponent, ".uno:EntireColumn", {}); + dispatchCommand(mxComponent, ".uno:MergeCells", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getColumns()->getCount()); + + CPPUNIT_ASSERT(xCellA1->getString().endsWith("test2")); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getColumns()->getCount()); + + xCellA1.set(xTextTable->getCellByName("A1"), uno::UNO_QUERY); + + CPPUNIT_ASSERT(xCellA1->getString().endsWith("test1")); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |