[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-6' - oox/source sd/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed May 5 21:48:06 UTC 2021


 oox/source/drawingml/table/predefined-table-styles.cxx |    6 +--
 sd/qa/unit/data/pptx/tdf132472.pptx                    |binary
 sd/qa/unit/export-tests-ooxml2.cxx                     |   31 +++++++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit c38003805d345da611ef6416fc8a95d0a134f40e
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 22 14:10:57 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed May 5 23:47:28 2021 +0200

    tdf#132472: do not set text color when table style is 'Themed-Style-2'
    
    and it has no Accent
    
    Regression from 2c3f7d4ee0a0b2bf6efc41670645bd361f1b76ef
    < tdf#107604 Handle predefined table styles. >
    
    Change-Id: Id9ab5b20825e2eaf8cc138c108608fe446f33db4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114477
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 54f7c32beca5a9c99d7316dc38818edad55f7415)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114497
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114649
    (cherry picked from commit b20c3473a9ba9ca0f96e9d004989233a32d3853c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114602
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx b/oox/source/drawingml/table/predefined-table-styles.cxx
index 4a8aec4cef1a..ea68911112a0 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -516,11 +516,11 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
     }
     else if (style_name == "Themed-Style-2")
     {
-        wholeTblTextColor.setSchemeClr(XML_lt1);
-        firstRowTextColor.setSchemeClr(XML_lt1);
-
         if (!accent_name.isEmpty())
         {
+            wholeTblTextColor.setSchemeClr(XML_lt1);
+            firstRowTextColor.setSchemeClr(XML_lt1);
+
             accent_val = tokens[mStyleIdMap[styleId].second];
 
             pTblBgFillProperties->maFillColor.setSchemeClr(accent_val);
diff --git a/sd/qa/unit/data/pptx/tdf132472.pptx b/sd/qa/unit/data/pptx/tdf132472.pptx
new file mode 100644
index 000000000000..e7873dcd5090
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf132472.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index c6d2f48aedde..553262385796 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -92,6 +92,7 @@ public:
     void testTdf119015();
     void testTdf123090();
     void testTdf126324();
+    void testTdf132472();
     void testTdf80224();
     void testExportTransitionsPPTX();
     void testPresetShapesExport();
@@ -208,6 +209,7 @@ public:
     CPPUNIT_TEST(testTdf119015);
     CPPUNIT_TEST(testTdf123090);
     CPPUNIT_TEST(testTdf126324);
+    CPPUNIT_TEST(testTdf132472);
     CPPUNIT_TEST(testTdf80224);
     CPPUNIT_TEST(testExportTransitionsPPTX);
     CPPUNIT_TEST(testPresetShapesExport);
@@ -570,6 +572,35 @@ void SdOOXMLExportTest2::testTdf126324()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf132472()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf132472.pptx"), PPTX );
+    const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+    sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT( pTableObj );
+
+    uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+    uno::Reference< beans::XPropertySet > xCell;
+    Color nColor;
+
+    xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue("FillColor") >>= nColor;
+    CPPUNIT_ASSERT_EQUAL(Color(0x729fcf), nColor);
+
+    uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, xCell));
+    uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
+    uno::Reference<beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY);
+    xPropSet->getPropertyValue("CharColor") >>= nColor;
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Color: R:0 G:0 B:0 A:0
+    // - Actual  : Color: R:255 G:255 B:255 A:0
+    CPPUNIT_ASSERT_EQUAL(COL_BLACK, nColor);
+
+    xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf80224()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP);


More information about the Libreoffice-commits mailing list