summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svx/qa/unit/data/tdf60684.jpgbin0 -> 35738 bytes
-rw-r--r--svx/qa/unit/xoutdev.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/svx/qa/unit/data/tdf60684.jpg b/svx/qa/unit/data/tdf60684.jpg
new file mode 100644
index 000000000000..2218cdd72df0
--- /dev/null
+++ b/svx/qa/unit/data/tdf60684.jpg
Binary files differ
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index 4e0cc5ff0b48..35eac21cda72 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -68,4 +68,32 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('-'), sFirstBytes[4]);
}
+CPPUNIT_TEST_FIXTURE(XOutdevTest, testTdf60684)
+{
+ Graphic aGraphic;
+ test::Directories aDirectories;
+ OUString aURL = aDirectories.getURLFromSrc(u"svx/qa/unit/data/tdf60684.jpg");
+ SvFileStream aStream(aURL, StreamMode::READ);
+ CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE,
+ GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
+
+ // Export it.
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ XOutFlags const eFlags = XOutFlags::DontExpandFilename | XOutFlags::DontAddExtension
+ | XOutFlags::UseNativeIfPossible;
+ OUString aTempURL = aTempFile.GetURL();
+ XOutBitmap::WriteGraphic(aGraphic, aTempURL, "png", eFlags);
+
+ SvStream* pStream = aTempFile.GetStream(StreamMode::READ);
+ CPPUNIT_ASSERT(pStream->TellEnd() > 4);
+ sal_uInt8 sFirstBytes[4];
+ pStream->ReadBytes(sFirstBytes, 4);
+
+ //Checks if the file's header matches a PNG's expected header
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('P'), sFirstBytes[1]);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('N'), sFirstBytes[2]);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('G'), sFirstBytes[3]);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */