From c8b2849d140677f7b35523096eb2bc715b3dc507 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 21 Sep 2018 16:28:58 +0200 Subject: Related: tdf#120028 PPTX import: fix font size of multi-col shape text Normal shapes have a TextFitToSize property for this, but table cell content has to be scaled manually, as the rendering has no automatic support for them. Luckily the file format has the info we need to scale at import time. Change-Id: Ibbcc4b8685995261536cce88b8c0774e148f708e Reviewed-on: https://gerrit.libreoffice.org/60880 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sd/qa/unit/import-tests.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sd') diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index cca17846c666..37e50f3ef931 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -2561,6 +2561,7 @@ void SdImportTest::testTdf119015() void SdImportTest::testTdf120028() { + // Check that the table shape has 4 columns. ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf120028.pptx"), PPTX); uno::Reference xDoc(xDocShRef->GetDoc()->getUnoModel(), @@ -2580,6 +2581,17 @@ void SdImportTest::testTdf120028() uno::Reference xColumns = xModel->getColumns(); CPPUNIT_ASSERT_EQUAL(static_cast(4), xColumns->getCount()); + // Check font size in the A1 cell. + uno::Reference xCells(xModel, uno::UNO_QUERY); + uno::Reference xCell(xCells->getCellByPosition(0, 0), uno::UNO_QUERY); + uno::Reference xParagraph(getParagraphFromShape(0, xCell)); + uno::Reference xRun(getRunFromParagraph(0, xParagraph)); + uno::Reference xPropSet(xRun, uno::UNO_QUERY); + double fCharHeight = 0; + xPropSet->getPropertyValue("CharHeight") >>= fCharHeight; + // This failed, non-scaled height was 13.5. + CPPUNIT_ASSERT_DOUBLES_EQUAL(11.5, fCharHeight, 1E-12); + xDocShRef->DoClose(); } -- cgit