[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 8 15:41:33 UTC 2021
sw/qa/extras/uiwriter/data/tdf45525.odt |binary
sw/qa/extras/uiwriter/uiwriter2.cxx | 33 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
New commits:
commit 263d2f0b3d1143d6caa467204f187648c43b0e89
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Oct 8 16:38:27 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Oct 8 17:40:56 2021 +0200
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 at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data/tdf45525.odt b/sw/qa/extras/uiwriter/data/tdf45525.odt
new file mode 100644
index 000000000000..056ac84bcd5c
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf45525.odt differ
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");
More information about the Libreoffice-commits
mailing list