summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-10-07 10:19:03 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-10-07 13:33:10 +0200
commit2129cc20ce67606cff22e32d4ce2e658240f5cd8 (patch)
tree45362728e0676ae3637855dde79eeca3630a5116 /sw
parent354706e3f5c05294af6e0000d5b9f814cfe01741 (diff)
tdf#144317: sw_uiwriter2: Add unittest
Change-Id: Ie2fa7b754f117aed35238cdb67698c05af24dadb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123204 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data/tdf144317.odtbin0 -> 15696 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx30
2 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf144317.odt b/sw/qa/extras/uiwriter/data/tdf144317.odt
new file mode 100644
index 000000000000..9ec7cee61ea9
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf144317.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 9765e83cecf4..409efcf22108 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1387,6 +1387,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns)
CPPUNIT_ASSERT_EQUAL_MESSAGE("Last column shouldn't change", nOrigCol3Pos, aSeq[1].Position);
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144317)
+{
+ SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf144317.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();
+
+ auto aSeq = getProperty<uno::Sequence<text::TableColumnSeparator>>(xTableRows->getByIndex(0),
+ "TableColumnSeparators");
+ sal_Int16 nOrigCol1Pos = aSeq[0].Position;
+
+ // Move the cursor inside the table
+ pWrtShell->Down(/*bSelect=*/false);
+
+ //Select some cells in the first column
+ pWrtShell->Down(/*bSelect=*/true);
+ pWrtShell->Down(/*bSelect=*/true);
+ pWrtShell->Down(/*bSelect=*/true);
+
+ dispatchCommand(mxComponent, ".uno:SetMinimalColumnWidth", {});
+
+ aSeq = getProperty<uno::Sequence<text::TableColumnSeparator>>(xTableRows->getByIndex(0),
+ "TableColumnSeparators");
+ CPPUNIT_ASSERT_MESSAGE("First column should shrink", aSeq[0].Position < nOrigCol1Pos);
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf108687_tabstop)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf108687_tabstop.odt");