summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-02-08 05:08:17 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-02-11 05:54:44 +0100
commitc2a4b16ebfde78c6180465c938475f67c4e8e7b7 (patch)
tree026c8d62ee1b920713ffe53ceee3638c2aafabd3
parent51cb2e66897a9dd5676b33d35a5683a8f8e56ef5 (diff)
extend testLinkedGraphicRT if state after import is as expected
Change-Id: Ia3452d7946148db20f8a876c92f945cb4e68ddb5 Reviewed-on: https://gerrit.libreoffice.org/49552 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--sd/qa/unit/export-tests.cxx49
1 files changed, 35 insertions, 14 deletions
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 73d8bb5c49c6..8994f0d8883c 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -549,8 +549,7 @@ void SdExportTest::testLinkedGraphicRT()
for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat )
{
// Load the original file with one image
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP);
- const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP);
// Export the document and import again for a check
uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
@@ -558,6 +557,24 @@ void SdExportTest::testLinkedGraphicRT()
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
+ // Check if the graphic has been imported correctly (before doing the export/import run)
+ {
+ const OString sFailedImportMessage = "Failed to correctly import the document";
+ SdDrawDocument* pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE(sFailedImportMessage.getStr(), pDoc != nullptr);
+ const SdrPage* pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE(sFailedImportMessage.getStr(), pPage != nullptr);
+ SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
+ CPPUNIT_ASSERT_MESSAGE(sFailedImportMessage.getStr(), pObject != nullptr );
+ CPPUNIT_ASSERT_MESSAGE(sFailedImportMessage.getStr(), pObject->IsLinkedGraphic() );
+
+ const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true);
+ CPPUNIT_ASSERT_MESSAGE(sFailedImportMessage.getStr(), !rGraphicObj.IsSwappedOut());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedImportMessage.getStr(), int(GraphicType::Bitmap), int(rGraphicObj.GetGraphic().GetType()));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedImportMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+ }
+
+ // Save and reload
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
@@ -566,18 +583,22 @@ void SdExportTest::testLinkedGraphicRT()
xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
// Check whether graphic imported well after export
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != nullptr );
- SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
- CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != nullptr );
- 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(), int(GraphicType::Bitmap), int(rGraphicObj.GetGraphic().GetType()));
- CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+ {
+ const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != nullptr );
+ const SdrPage *pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != nullptr );
+ SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
+ CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != nullptr );
+ 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(), int(GraphicType::Bitmap), int(rGraphicObj.GetGraphic().GetType()));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+ }
xDocShRef->DoClose();
}