diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-10-08 16:38:27 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-10-08 17:40:56 +0200 |
commit | 263d2f0b3d1143d6caa467204f187648c43b0e89 (patch) | |
tree | 92e3e9b8c51b54bc4694cc11899531218131e363 /sw/qa | |
parent | c59edf5d4dd94224b586adf03b3dcdbda4d422ab (diff) |
tdf#45525: sw_uiwriter2: Add unittest
Change-Id: I266efb1fc95a782d0fd75e16bd099e5c5359f9f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123262
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf45525.odt | bin | 0 -> 11985 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf45525.odt b/sw/qa/extras/uiwriter/data/tdf45525.odt Binary files differnew file mode 100644 index 000000000000..056ac84bcd5c --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf45525.odt diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 409efcf22108..07356f6ea478 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1360,6 +1360,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable) CPPUNIT_ASSERT_EQUAL_MESSAGE("Row set to auto-height", double(0), minimalRowHeight); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf45525) +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf45525.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); + + CPPUNIT_ASSERT_EQUAL(3889.0, getProperty<double>(xTableRows->getByIndex(0), "Height")); + CPPUNIT_ASSERT_EQUAL(0.0, getProperty<double>(xTableRows->getByIndex(1), "Height")); + CPPUNIT_ASSERT_EQUAL(0.0, getProperty<double>(xTableRows->getByIndex(2), "Height")); + CPPUNIT_ASSERT_EQUAL(0.0, getProperty<double>(xTableRows->getByIndex(3), "Height")); + CPPUNIT_ASSERT_EQUAL(0.0, getProperty<double>(xTableRows->getByIndex(4), "Height")); + + //Select three cells in the first column + pWrtShell->Down(/*bSelect=*/true); + pWrtShell->Down(/*bSelect=*/true); + + dispatchCommand(mxComponent, ".uno:SetOptimalRowHeight", {}); + + // Without the fix in place, this test would have failed with + // - Expected: 1914 + // - Actual : 3889 + CPPUNIT_ASSERT_EQUAL(1914.0, getProperty<double>(xTableRows->getByIndex(0), "Height")); + CPPUNIT_ASSERT_EQUAL(1914.0, getProperty<double>(xTableRows->getByIndex(1), "Height")); + CPPUNIT_ASSERT_EQUAL(1914.0, getProperty<double>(xTableRows->getByIndex(2), "Height")); + CPPUNIT_ASSERT_EQUAL(0.0, getProperty<double>(xTableRows->getByIndex(3), "Height")); + CPPUNIT_ASSERT_EQUAL(0.0, getProperty<double>(xTableRows->getByIndex(4), "Height")); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf126784_distributeSelectedColumns.odt"); |