diff options
author | Mark Hung <marklh9@gmail.com> | 2019-11-02 14:28:57 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2019-11-10 12:32:24 +0100 |
commit | 2971f6bbabe5871e9ef462e94239c652db3aede0 (patch) | |
tree | 70f9b2b85430e7431cfa2c17a8027fa344821f03 /sd/qa | |
parent | 4438e7dcbfd78b117b704fd4d15b2e445c3db0b0 (diff) |
tdf#106638 oox: reset font settings if necessary.
Direct formatting was used when symbols were inserted.
However when there wasn't any direct formatting of Latin
fonts in the following runs, it didn't know how to reset
the font. Get the default font with XPropertyState and
try to reset to the default value if symbol fonts are set.
Change-Id: I83c9317ba61a96375128f1cc3ed478d958ddaa5c
Reviewed-on: https://gerrit.libreoffice.org/81956
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf106638.pptx | bin | 0 -> 447309 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf106638.pptx b/sd/qa/unit/data/pptx/tdf106638.pptx Binary files differnew file mode 100644 index 000000000000..6a4d7819eee0 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf106638.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index a7f1a9a344e5..90c261c753e2 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -81,6 +81,7 @@ #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/text/XTextCursor.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> #include <stlpool.hxx> @@ -210,6 +211,7 @@ public: void testOOXTheme(); void testCropToShape(); void testTdf127964(); + void testTdf106638(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -308,6 +310,7 @@ public: CPPUNIT_TEST(testOOXTheme); CPPUNIT_TEST(testCropToShape); CPPUNIT_TEST(testTdf127964); + CPPUNIT_TEST(testTdf106638); CPPUNIT_TEST_SUITE_END(); }; @@ -2982,6 +2985,27 @@ void SdImportTest::testTdf127964() xDocShRef->DoClose(); } +void SdImportTest::testTdf106638() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf106638.pptx"), PPTX); + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); + uno::Reference<text::XTextRange> const xPara(getParagraphFromShape(1, xShape)); + uno::Reference<text::XText> xText= xPara->getText(); + uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursorByRange(xPara->getStart()); + uno::Reference<beans::XPropertySet> xPropSet(xTextCursor, uno::UNO_QUERY_THROW ); + OUString aCharFontName; + CPPUNIT_ASSERT(xTextCursor->goRight(1, true)); + // First charcter U+f0fe that use Wingding + xPropSet->getPropertyValue("CharFontName") >>= aCharFontName; + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), aCharFontName); + + // The rest characters that do not use Wingding. + CPPUNIT_ASSERT(xTextCursor->goRight(45, true)); + xPropSet->getPropertyValue("CharFontName") >>= aCharFontName; + CPPUNIT_ASSERT(aCharFontName != "Wingdings"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |