diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-12-05 00:39:01 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-12-07 16:21:40 +0100 |
commit | 33e49c711c988dfbbb75b605878850f83180a796 (patch) | |
tree | ad12d2b4be558053a35518cdd089d747d20165b9 /sd | |
parent | 9d0f597cee004b4f09f87e3599a85fc2e3672ee9 (diff) |
Test for linked graphic export / import of Impress
To avoid regression fixed by:
02b17c1bbdd19a978b9de646c0dacdad179c60de
It seems PPTX import is broken now.
Change-Id: I17228f4d8511b43d028b9ed8a6e77505e6143860
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/document_with_linked_graphic.odp | bin | 0 -> 49906 bytes | |||
-rw-r--r-- | sd/qa/unit/data/odp/linked_graphic.jpg | bin | 0 -> 35738 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 48 |
3 files changed, 48 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/document_with_linked_graphic.odp b/sd/qa/unit/data/odp/document_with_linked_graphic.odp Binary files differnew file mode 100644 index 000000000000..b0c327d44226 --- /dev/null +++ b/sd/qa/unit/data/odp/document_with_linked_graphic.odp diff --git a/sd/qa/unit/data/odp/linked_graphic.jpg b/sd/qa/unit/data/odp/linked_graphic.jpg Binary files differnew file mode 100644 index 000000000000..2218cdd72df0 --- /dev/null +++ b/sd/qa/unit/data/odp/linked_graphic.jpg diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 189dbf2ea7de..7b176681ee83 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -79,6 +79,7 @@ public: void testFdo83751(); void testFdo79731(); void testSwappedOutImageExport(); + void testLinkedGraphicRT(); CPPUNIT_TEST_SUITE(SdExportTest); CPPUNIT_TEST(testN821567); @@ -96,6 +97,7 @@ public: CPPUNIT_TEST(testFdo83751); CPPUNIT_TEST(testFdo79731); CPPUNIT_TEST(testSwappedOutImageExport); + CPPUNIT_TEST(testLinkedGraphicRT); CPPUNIT_TEST_SUITE_END(); }; @@ -590,6 +592,52 @@ void SdExportTest::testSwappedOutImageExport() } } +void SdExportTest::testLinkedGraphicRT() +{ + // Problem was with linked images + const sal_Int32 vFormats[] = { + ODP, + PPT, +// PPTX, -> this fails now, need a fix + }; + + for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat ) + { + // Load the original file with one image + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP); + const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName); + + // Export the document and import again for a check + uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); + utl::MediaDescriptor aMediaDescriptor; + aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + xComponent.set(xStorable, uno::UNO_QUERY); + xComponent->dispose(); + xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat); + + // Check whether graphic imported well after export + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage(1); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL ); + SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2)); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != NULL ); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject->IsLinkedGraphic() ); + + const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true); + CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), !rGraphicObj.IsSwappedOut()); + CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), GRAPHIC_BITMAP, rGraphicObj.GetGraphic().GetType()); + CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes()); + + xDocShRef->DoClose(); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |