summaryrefslogtreecommitdiff
path: root/desktop/qa/desktop_lib/test_desktop_lib.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/qa/desktop_lib/test_desktop_lib.cxx')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 01657b9a1f81..d55ae37b6606 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>
#include <boost/property_tree/json_parser.hpp>
#include <comphelper/processfactory.hxx>
#include <sfx2/objsh.hxx>
@@ -74,6 +75,7 @@ public:
void testSaveAs();
void testSaveAsCalc();
void testPasteWriter();
+ void testPasteWriterJPEG();
void testRowColumnHeaders();
void testCellCursor();
void testCommandResult();
@@ -91,6 +93,7 @@ public:
CPPUNIT_TEST(testSaveAs);
CPPUNIT_TEST(testSaveAsCalc);
CPPUNIT_TEST(testPasteWriter);
+ CPPUNIT_TEST(testPasteWriterJPEG);
CPPUNIT_TEST(testRowColumnHeaders);
CPPUNIT_TEST(testCellCursor);
CPPUNIT_TEST(testCommandResult);
@@ -409,6 +412,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()
{
/*