diff options
-rw-r--r-- | desktop/qa/data/paste.jpg | bin | 0 -> 696 bytes | |||
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/desktop/qa/data/paste.jpg b/desktop/qa/data/paste.jpg Binary files differnew file mode 100644 index 000000000000..ca9183e9d308 --- /dev/null +++ b/desktop/qa/data/paste.jpg diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 87aaf2f522da..5e7a14d1614a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/awt/XReschedule.hpp> #include <com/sun/star/awt/Toolkit.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #ifdef WNT #include <prewin.h> @@ -81,6 +82,7 @@ public: void testSaveAs(); void testSaveAsCalc(); void testPasteWriter(); + void testPasteWriterJPEG(); void testRowColumnHeaders(); void testCommandResult(); void testWriterComments(); @@ -97,6 +99,7 @@ public: CPPUNIT_TEST(testSaveAs); CPPUNIT_TEST(testSaveAsCalc); CPPUNIT_TEST(testPasteWriter); + CPPUNIT_TEST(testPasteWriterJPEG); CPPUNIT_TEST(testRowColumnHeaders); CPPUNIT_TEST(testCommandResult); CPPUNIT_TEST(testWriterComments); @@ -414,6 +417,27 @@ void DesktopLOKTest::testPasteWriter() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testPasteWriterJPEG() +{ + comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + OString aText("hello"); + + OUString aFileURL; + createFileURL(OUString::createFromAscii("paste.jpg"), aFileURL); + std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr()); + std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>()); + + CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "image/jpeg", aImageContents.data(), aImageContents.size())); + + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + // This was 0, JPEG was not handled as a format for clipboard paste. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xDrawPage->getCount()); + + comphelper::LibreOfficeKit::setActive(false); +} + void DesktopLOKTest::testRowColumnHeaders() { /* |