From adb203bc05e3e36173cbd46b9951f79821a81799 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:54 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sd/qa/unit/data/pptx/tdf156718.pptx | Bin 0 -> 14422 bytes sd/qa/unit/export-tests-ooxml4.cxx | 22 +++++------- sd/qa/unit/import-tests.cxx | 70 ++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 sd/qa/unit/data/pptx/tdf156718.pptx (limited to 'sd/qa') diff --git a/sd/qa/unit/data/pptx/tdf156718.pptx b/sd/qa/unit/data/pptx/tdf156718.pptx new file mode 100644 index 0000000000..8aeafa1557 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf156718.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index b09614454d..c4c061c50d 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -751,22 +751,18 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf147121) CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf140912_PicturePlaceholder) { - // FIXME: the DPI check should be removed when either (1) the test is fixed to work with - // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin. - // -8490 in the test below turns into -8014 on my Windows box with 150% scaling. - if (!IsDefaultDPI()) - return; - + // Given a graphic placeholder with a custom prompt: createSdImpressDoc("pptx/tdfpictureplaceholder.pptx"); uno::Reference xShapeProps(getShapeFromPage(0, 0)); - bool bTextContourFrame = true; - xShapeProps->getPropertyValue("TextContourFrame") >>= bTextContourFrame; - CPPUNIT_ASSERT_EQUAL(false, bTextContourFrame); - - text::GraphicCrop aGraphicCrop; - xShapeProps->getPropertyValue("GraphicCrop") >>= aGraphicCrop; - CPPUNIT_ASSERT_EQUAL(static_cast(-8490), aGraphicCrop.Top); + bool isEmptyPresentationObject = false; + // Without the fix, it would not be imported as empty presentation object; + // the text would be treated as its content. + xShapeProps->getPropertyValue("IsEmptyPresentationObject") >>= isEmptyPresentationObject; + CPPUNIT_ASSERT(isEmptyPresentationObject); + + // If we supported custom prompt text, here we would also test "String" property, + // which would be equal to "Insert Image". } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testEnhancedPathViewBox) diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index c08e44ea26..d6beee8769 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -203,6 +204,75 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testDocumentLayout) } } +CPPUNIT_TEST_FIXTURE(SdImportTest, testTableStyle) +{ + createSdImpressDoc("pptx/tdf156718.pptx"); + const SdrPage* pPage = GetPage(1); + + sdr::table::SdrTableObj* pTableObj = dynamic_cast(pPage->GetObj(0)); + CPPUNIT_ASSERT(pTableObj); + + uno::Reference xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW); + uno::Reference xCellPropSet; + uno::Reference xRunPropSet; + uno::Reference xParagraph; + uno::Reference xRun; + table::BorderLine2 aBorderLine; + Color nFillColor, nCharColor; + float nFontWeight; + + xCellPropSet.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xParagraph.set(getParagraphFromShape(0, xCellPropSet)); + xRun.set(getRunFromParagraph(0, xParagraph)); + xRunPropSet.set(xRun, uno::UNO_QUERY_THROW); + xRunPropSet->getPropertyValue("CharColor") >>= nCharColor; + xRunPropSet->getPropertyValue("CharWeight") >>= nFontWeight; + xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine; + CPPUNIT_ASSERT_EQUAL(Color(0x000000), nCharColor); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, nFontWeight); + CPPUNIT_ASSERT_EQUAL_MESSAGE("The bottom border is missing!", true, aBorderLine.LineWidth > 0); + + xCellPropSet.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW); + xParagraph.set(getParagraphFromShape(0, xCellPropSet)); + xRun.set(getRunFromParagraph(0, xParagraph)); + xRunPropSet.set(xRun, uno::UNO_QUERY_THROW); + xRunPropSet->getPropertyValue("CharColor") >>= nCharColor; + xRunPropSet->getPropertyValue("CharWeight") >>= nFontWeight; + CPPUNIT_ASSERT_EQUAL(Color(0x000000), nCharColor); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, nFontWeight); + + xCellPropSet.set(xTable->getCellByPosition(2, 0), uno::UNO_QUERY_THROW); + xParagraph.set(getParagraphFromShape(0, xCellPropSet)); + xRun.set(getRunFromParagraph(0, xParagraph)); + xRunPropSet.set(xRun, uno::UNO_QUERY_THROW); + xRunPropSet->getPropertyValue("CharColor") >>= nCharColor; + xRunPropSet->getPropertyValue("CharWeight") >>= nFontWeight; + CPPUNIT_ASSERT_EQUAL(Color(0x000000), nCharColor); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, nFontWeight); + + xCellPropSet.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); + xParagraph.set(getParagraphFromShape(0, xCellPropSet)); + xRun.set(getRunFromParagraph(0, xParagraph)); + xRunPropSet.set(xRun, uno::UNO_QUERY_THROW); + xRunPropSet->getPropertyValue("CharColor") >>= nCharColor; + xRunPropSet->getPropertyValue("CharWeight") >>= nFontWeight; + xCellPropSet->getPropertyValue("FillColor") >>= nFillColor; + CPPUNIT_ASSERT_EQUAL(Color(0x000000), nCharColor); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, nFontWeight); + CPPUNIT_ASSERT_EQUAL(Color(0x5b9bd5), nFillColor); + + xCellPropSet.set(xTable->getCellByPosition(2, 1), uno::UNO_QUERY_THROW); + xParagraph.set(getParagraphFromShape(0, xCellPropSet)); + xRun.set(getRunFromParagraph(0, xParagraph)); + xRunPropSet.set(xRun, uno::UNO_QUERY_THROW); + xRunPropSet->getPropertyValue("CharColor") >>= nCharColor; + xRunPropSet->getPropertyValue("CharWeight") >>= nFontWeight; + xCellPropSet->getPropertyValue("FillColor") >>= nFillColor; + CPPUNIT_ASSERT_EQUAL(Color(0x000000), nCharColor); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, nFontWeight); + CPPUNIT_ASSERT_EQUAL(Color(0x5b9bd5), nFillColor); +} + CPPUNIT_TEST_FIXTURE(SdImportTest, testFreeformShapeGluePoints) { createSdImpressDoc("pptx/tdf156829.pptx"); -- cgit v1.2.3