[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 7 11:33:45 UTC 2021


 sw/qa/extras/uiwriter/data/tdf144317.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx      |   30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

New commits:
commit 2129cc20ce67606cff22e32d4ce2e658240f5cd8
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Oct 7 10:19:03 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Oct 7 13:33:10 2021 +0200

    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 at libreoffice.org>

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
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf144317.odt 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");


More information about the Libreoffice-commits mailing list