diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-07 01:23:03 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-07 06:01:36 +0100 |
commit | ecb5130e16898c0d2485e99564c57882b5ef25b0 (patch) | |
tree | a57f0911372ac2779ef411d3505d5fa8f71efee7 /sw/qa/extras/unowriter | |
parent | 035c7717c135c66c0ec025500b73ae9c13b7c586 (diff) |
tdf#129841: fix GetTextTableCursorPropertyMap cell background values
... which were accidentally broken in 2003 in commit
eba784710e92597282a2284b56dce3a45ac38776.
Change-Id: I3dc96dff0a8935f927933bb3946528fb8ac9aed0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86315
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/unowriter')
-rw-r--r-- | sw/qa/extras/unowriter/unowriter.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 14fbbe2d306a..271261fc71cb 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -864,6 +864,40 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129839) CPPUNIT_ASSERT_EQUAL(css::uno::Any(css::text::VertOrientation::NONE), aOrient); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841) +{ + // Create a new document and add a table + loadURL("private:factory/swriter", nullptr); + css::uno::Reference<css::text::XTextDocument> xTextDocument(mxComponent, + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::lang::XMultiServiceFactory> xFac(xTextDocument, + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::text::XTextTable> xTable( + xFac->createInstance("com.sun.star.text.TextTable"), css::uno::UNO_QUERY_THROW); + xTable->initialize(4, 4); + auto xSimpleText = xTextDocument->getText(); + xSimpleText->insertTextContent(xSimpleText->createTextCursor(), xTable, true); + // Get SwXTextTableCursor + css::uno::Reference<css::beans::XPropertySet> xTableCursor(xTable->createCursorByCellName("A1"), + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::table::XCellRange> xTableCellRange(xTable, css::uno::UNO_QUERY_THROW); + // Get SwXCellRange for the same cell + css::uno::Reference<css::beans::XPropertySet> xCellRange( + xTableCellRange->getCellRangeByName("A1:A1"), css::uno::UNO_QUERY_THROW); + const OUString sBackColor = "BackColor"; + // Apply background color to table cursor, and read background color from cell range + css::uno::Any aRefColor(sal_Int32(0x00FF0000)); + xTableCursor->setPropertyValue(sBackColor, aRefColor); + css::uno::Any aColor = xCellRange->getPropertyValue(sBackColor); + // This failed + CPPUNIT_ASSERT_EQUAL(aRefColor, aColor); + // Now the other way round + aRefColor <<= sal_Int32(0x0000FF00); + xCellRange->setPropertyValue(sBackColor, aRefColor); + aColor = xTableCursor->getPropertyValue(sBackColor); + CPPUNIT_ASSERT_EQUAL(aRefColor, aColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |