summaryrefslogtreecommitdiff
path: root/sd/qa/unit/export-tests-ooxml2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/qa/unit/export-tests-ooxml2.cxx')
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 0cf675be8cf2..4840940274f2 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -134,6 +134,9 @@ public:
void testTdf115394Zero();
void testBulletsAsImage();
void testTdf115005();
+ int testTdf115005_FallBack_Images(bool bAddReplacementImages);
+ void testTdf115005_FallBack_Images_On();
+ void testTdf115005_FallBack_Images_Off();
void testTdf111789();
/// SmartArt animated elements
void testTdf104792();
@@ -199,6 +202,8 @@ public:
CPPUNIT_TEST(testTdf115394Zero);
CPPUNIT_TEST(testBulletsAsImage);
CPPUNIT_TEST(testTdf115005);
+ CPPUNIT_TEST(testTdf115005_FallBack_Images_On);
+ CPPUNIT_TEST(testTdf115005_FallBack_Images_Off);
CPPUNIT_TEST(testTdf111789);
CPPUNIT_TEST(testTdf104792);
CPPUNIT_TEST(testTdf90627);
@@ -1546,6 +1551,55 @@ void SdOOXMLExportTest2::testTdf115005()
CPPUNIT_ASSERT_EQUAL(3, nSVMFiles);
}
+int SdOOXMLExportTest2::testTdf115005_FallBack_Images(bool bAddReplacementImages)
+{
+ sd::DrawDocShellRef xDocShRefOriginal = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf115005_no_fallback_images.odp"), ODP);
+
+ // check if fallback images were not created if AddReplacementImages=true/false
+ // set AddReplacementImages
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> batch( comphelper::ConfigurationChanges::create() );
+ if ( !officecfg::Office::Common::Save::Graphic::AddReplacementImages::isReadOnly() )
+ officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(bAddReplacementImages, batch);
+ batch->commit();
+ }
+
+ // save the file with already set options
+ utl::TempFile tempFile;
+ sd::DrawDocShellRef xDocShRefResaved = saveAndReload(xDocShRefOriginal.get(), ODP, &tempFile);
+
+ // additional checks of the output file
+ uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL());
+
+ // check that the document contains original vector images
+ const uno::Sequence<OUString> names = xNameAccess->getElementNames();
+ int nSVMFiles = 0;
+ int nPNGFiles = 0;
+ for (int i=0; i<names.getLength(); i++)
+ {
+ if(names[i].endsWith(".svm"))
+ nSVMFiles++;
+ if(names[i].endsWith(".png"))
+ nPNGFiles++;
+ }
+
+ // check results
+ CPPUNIT_ASSERT_EQUAL(1, nSVMFiles);
+ return nPNGFiles;
+}
+
+void SdOOXMLExportTest2::testTdf115005_FallBack_Images_On()
+{
+ const int nPNGFiles = testTdf115005_FallBack_Images(true);
+ CPPUNIT_ASSERT_EQUAL(1, nPNGFiles);
+}
+
+void SdOOXMLExportTest2::testTdf115005_FallBack_Images_Off()
+{
+ const int nPNGFiles = testTdf115005_FallBack_Images(false);
+ CPPUNIT_ASSERT_EQUAL(0, nPNGFiles);
+}
+
void SdOOXMLExportTest2::testTdf111789()
{
// Shadow properties were not exported for text shapes.