summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-05-27 20:00:42 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-28 14:09:42 +0200
commit14c4e6155271d04f0a86029635d0a4c0b460146a (patch)
tree7a5ff528a8858ba5cdf1fd5c1acb766f691cb0b4 /sd
parenta2179fb76bb1e1da43e8185130866ea334537b13 (diff)
SmartArt: adjust text size to fit shapes
up to maximal size of primFontSz constraint. Do not override text size changed by user. Change-Id: If7ea6bbb96cb839831d877edc274a1b0eefdaf21 Reviewed-on: https://gerrit.libreoffice.org/73050 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/smartart-font-size.pptxbin0 -> 63915 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx33
2 files changed, 33 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-font-size.pptx b/sd/qa/unit/data/pptx/smartart-font-size.pptx
new file mode 100644
index 000000000000..253cd4c73b65
--- /dev/null
+++ b/sd/qa/unit/data/pptx/smartart-font-size.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 1e726a5d1339..f07cca532e1b 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -11,6 +11,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/text/XText.hpp>
@@ -75,6 +76,7 @@ public:
void testBackground();
void testBackgroundDrawingmlFallback();
void testCenterCycle();
+ void testFontSize();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -112,6 +114,7 @@ public:
CPPUNIT_TEST(testBackground);
CPPUNIT_TEST(testBackgroundDrawingmlFallback);
CPPUNIT_TEST(testCenterCycle);
+ CPPUNIT_TEST(testFontSize);
CPPUNIT_TEST_SUITE_END();
};
@@ -1166,6 +1169,36 @@ void SdImportTestSmartArt::testCenterCycle()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testFontSize()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-font-size.pptx"), PPTX);
+
+ uno::Reference<drawing::XShapes> xGroup1(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShape1(xGroup1->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xParagraph1(getParagraphFromShape(0, xShape1));
+ uno::Reference<text::XTextRange> xRun1(getRunFromParagraph(0, xParagraph1));
+ uno::Reference<beans::XPropertySet> xPropSet1(xRun1, uno::UNO_QUERY);
+ double fFontSize1 = xPropSet1->getPropertyValue("CharHeight").get<double>();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(65.0, fFontSize1, 0.01);
+
+ uno::Reference<drawing::XShapes> xGroup2(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShape2(xGroup2->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xParagraph2(getParagraphFromShape(0, xShape2));
+ uno::Reference<text::XTextRange> xRun2(getRunFromParagraph(0, xParagraph2));
+ uno::Reference<beans::XPropertySet> xPropSet2(xRun2, uno::UNO_QUERY);
+ double fFontSize2 = xPropSet2->getPropertyValue("CharHeight").get<double>();
+ CPPUNIT_ASSERT_EQUAL(32.0, fFontSize2);
+
+ uno::Reference<drawing::XShapes> xGroup3(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShape3(xGroup3->getByIndex(1), uno::UNO_QUERY);
+ drawing::TextFitToSizeType eTextFitToSize = drawing::TextFitToSizeType_NONE;
+ xShape3->getPropertyValue("TextFitToSize") >>= eTextFitToSize;
+ CPPUNIT_ASSERT_EQUAL(drawing::TextFitToSizeType_AUTOFIT, eTextFitToSize);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();