diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-19 14:29:33 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-19 14:54:44 +0100 |
commit | 802564e036db1ee3df8b19593b7f9f1be0deec54 (patch) | |
tree | e1daedb69e6aac6b39892b3bd1a28012c07ca392 /desktop | |
parent | 723719b41348e275c760c6c66bbc9619fafa37fe (diff) |
CppunitTest_desktop_lib: add jpeg paste testcase
Fails without commit 27c6b8586d5d2cd1fa5425b4969d915a0b739475 (svtools:
implement clipboard import of JPEG files, 2016-01-19).
Change-Id: Ic4e3b036b3a6a1c294bf15ef0b206cf1e458fc4e
Diffstat (limited to 'desktop')
-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 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() { /* |