diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-22 15:51:41 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-22 15:51:41 +0200 |
commit | d491ae5692f0b1fb4653510e694bbf5227375858 (patch) | |
tree | ded86e601e3c12277dcd20eca750353fbba03e09 /desktop | |
parent | 4c6db362dc31edaefd553860d1e0ef0be55c4862 (diff) |
desktop: add lok::Document::paste() testcase
Also, closeDoc() is called by tearDown(), so no need to call it manually
at the end of tests.
Change-Id: Ib8f61a09fa3fc0885d7ea90ce96210bff4cc9f98
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/CppunitTest_desktop_lib.mk | 1 | ||||
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 24 |
2 files changed, 18 insertions, 7 deletions
diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk index a1f712585507..ca9d8db32c9f 100644 --- a/desktop/CppunitTest_desktop_lib.mk +++ b/desktop/CppunitTest_desktop_lib.mk @@ -45,6 +45,7 @@ $(eval $(call gb_CppunitTest_use_vcl,desktop_lib)) $(eval $(call gb_CppunitTest_use_components,desktop_lib,\ comphelper/util/comphelp \ configmgr/source/configmgr \ + dtrans/util/mcnttype \ filter/source/config/cache/filterconfig1 \ filter/source/storagefilterdetect/storagefd \ framework/util/fwk \ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 3e8544c6c5d2..a75d230d774b 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -65,6 +65,7 @@ public: void testPaintTile(); void testSaveAs(); void testSaveAsCalc(); + void testPasteWriter(); CPPUNIT_TEST_SUITE(DesktopLOKTest); CPPUNIT_TEST(testGetStyles); @@ -76,6 +77,7 @@ public: CPPUNIT_TEST(testPaintTile); CPPUNIT_TEST(testSaveAs); CPPUNIT_TEST(testSaveAsCalc); + CPPUNIT_TEST(testPasteWriter); CPPUNIT_TEST_SUITE_END(); uno::Reference<lang::XComponent> mxComponent; @@ -174,7 +176,6 @@ void DesktopLOKTest::testGetStyles() CPPUNIT_FAIL("Unknown style family: " + rPair.first); } } - closeDoc(); } void DesktopLOKTest::testGetFonts() @@ -194,7 +195,6 @@ void DesktopLOKTest::testGetFonts() // check that we have font sizes available for each font CPPUNIT_ASSERT( rPair.second.size() > 0); } - closeDoc(); } void DesktopLOKTest::testCreateView() @@ -213,7 +213,6 @@ void DesktopLOKTest::testCreateView() pDocument->m_pDocumentClass->destroyView(pDocument, nId); CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); - closeDoc(); } void DesktopLOKTest::testGetPartPageRectangles() @@ -236,7 +235,6 @@ void DesktopLOKTest::testGetPartPageRectangles() CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aRectangles.size()); free(pRectangles); - closeDoc(); } void DesktopLOKTest::testGetFilterTypes() @@ -283,7 +281,6 @@ void DesktopLOKTest::testSearchCalc() // Result is on the first sheet. CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); - closeDoc(); comphelper::LibreOfficeKit::setActive(false); } @@ -310,8 +307,6 @@ void DesktopLOKTest::testPaintTile() nTileHeight = 4000; aBuffer.resize(nCanvasWidth * nCanvasHeight * 4); pDocument->pClass->paintTile(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); - - closeDoc(); } void DesktopLOKTest::testSaveAs() @@ -330,6 +325,21 @@ void DesktopLOKTest::testSaveAsCalc() CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0)); } +void DesktopLOKTest::testPasteWriter() +{ + comphelper::LibreOfficeKit::setActive(true); + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + OString aText("hello"); + + pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()); + + pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", 0); + char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", 0); + CPPUNIT_ASSERT_EQUAL(OString("hello"), OString(pText)); + free(pText); + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); CPPUNIT_PLUGIN_IMPLEMENT(); |