summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-22 15:51:41 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-27 10:00:03 +0100
commita8ea266cba4864be8dd27cc7d0f3c497241724fa (patch)
tree1c49fa6ff3f5c9f213d5dc9873f933dc9300b231
parent22fe9c37f3f5e3f55e814178a85baefade033e11 (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 (cherry picked from commit d491ae5692f0b1fb4653510e694bbf5227375858)
-rw-r--r--desktop/CppunitTest_desktop_lib.mk1
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx24
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 3730fd106362..9f0124993ee3 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();