diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-11-06 20:16:25 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-11-06 20:20:05 +0100 |
commit | b3cfb849b19dc1e40c12586bebd2b76fc41007fa (patch) | |
tree | e1591f4aca9b320325d9b5734039460790099a4e /sd/qa/unit/export-tests.cxx | |
parent | 21f61ffeb7e72caee98f12cac2dd25fe7ec3a821 (diff) |
tdf#112547 sd: add unit test
Change-Id: If63f004c95208d49743f389746ca430ad91e1231
Diffstat (limited to 'sd/qa/unit/export-tests.cxx')
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index e6441fcb8ce1..78c5d4d68753 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -88,6 +88,7 @@ public: void testTdf62176(); void testTransparentBackground(); void testEmbeddedPdf(); + void testEmbeddedText(); void testAuthorField(); void testTdf100926(); void testPageWithTransparentBackground(); @@ -107,6 +108,7 @@ public: CPPUNIT_TEST(testTdf62176); CPPUNIT_TEST(testTransparentBackground); CPPUNIT_TEST(testEmbeddedPdf); + CPPUNIT_TEST(testEmbeddedText); CPPUNIT_TEST(testAuthorField); CPPUNIT_TEST(testTdf100926); CPPUNIT_TEST(testPageWithTransparentBackground); @@ -639,6 +641,36 @@ void SdExportTest::testEmbeddedPdf() #endif } +void SdExportTest::testEmbeddedText() +{ + sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/objectwithtext.fodg"), FODG); + xShell = saveAndReload( xShell.get(), ODG ); + + uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell); + uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XText> xText(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xText.is()); + + uno::Reference<container::XEnumerationAccess> xEA(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xEA->hasElements()); + uno::Reference<container::XEnumeration> xEnum(xEA->createEnumeration()); + uno::Reference<text::XTextContent> xTC; + xEnum->nextElement() >>= xTC; + CPPUNIT_ASSERT(xTC.is()); + + uno::Reference<container::XEnumerationAccess> xParaEA(xTC, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum(xParaEA->createEnumeration()); + uno::Reference<beans::XPropertySet> xPortion(xParaEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xPortion.is()); + uno::Reference<text::XTextRange> xRange(xPortion, uno::UNO_QUERY); + OUString type; + xPortion->getPropertyValue("TextPortionType") >>= type; + CPPUNIT_ASSERT_EQUAL(OUString("Text"), type); + CPPUNIT_ASSERT_EQUAL(OUString("foobar"), xRange->getString()); //tdf#112547 + + xShell->DoClose(); +} + void SdExportTest::testAuthorField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), ODP); |