From 89b385c2336e5b3868d2a040e11134b349b7d010 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 14 Sep 2020 16:58:38 +0200 Subject: oox smartart: handle Which defines that a data node has text properties as direct formatting, so autoscale should not happen. We decide autofit at a shape level, smartart defines custom text props at a data node level. So take the shape, go to its first presentation node, get its data node and see if it has custom text props. If not, continue to scale text down till it fits. smartart-autofit-sync.pptx is extended to contain a 3rd shape: the first two have their autofit scaling synchronized, while the 3rd has a fixed font size of 10pt. Change-Id: I6caacdaab9a36072b9ad5021bd217c955b09b790 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102689 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sd/qa/unit/data/pptx/smartart-autofit-sync.pptx | Bin 45546 -> 41874 bytes sd/qa/unit/import-tests-smartart.cxx | 11 +++++++++++ 2 files changed, 11 insertions(+) (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/smartart-autofit-sync.pptx b/sd/qa/unit/data/pptx/smartart-autofit-sync.pptx index f682c143f584..9a6ce0f494c5 100644 Binary files a/sd/qa/unit/data/pptx/smartart-autofit-sync.pptx and b/sd/qa/unit/data/pptx/smartart-autofit-sync.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index ddc0bb9579e2..616f18f0b5f0 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1591,6 +1591,17 @@ void SdImportTestSmartArt::testAutofitSync() // requested that their scaling matches. CPPUNIT_ASSERT_EQUAL(nSecondScale, nFirstScale); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 0 (drawing::TextFitToSizeType_NONE) + // - Actual : 3 (TextFitToSizeType_AUTOFIT) + // i.e. the 3rd shape had font size as direct formatting, but its automatic text scale was not + // disabled. + uno::Reference xThirdInner(getChildShape(getChildShape(xMiddle, 4), 0), + uno::UNO_QUERY); + drawing::TextFitToSizeType eType{}; + CPPUNIT_ASSERT(xThirdInner->getPropertyValue("TextFitToSize") >>= eType); + CPPUNIT_ASSERT_EQUAL(drawing::TextFitToSizeType_NONE, eType); + xDocShRef->DoClose(); } -- cgit