[Libreoffice-commits] core.git: 3 commits - desktop/CppunitTest_desktop_lib.mk desktop/qa sc/inc sc/source sd/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Oct 22 06:55:20 PDT 2015


 desktop/CppunitTest_desktop_lib.mk          |    1 +
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   24 +++++++++++++++++-------
 sc/inc/docuno.hxx                           |    3 +++
 sc/source/ui/unoobj/docuno.cxx              |   11 +++++++++++
 sd/source/ui/inc/unomodel.hxx               |    2 ++
 sd/source/ui/unoidl/unomodel.cxx            |   11 +++++++++++
 6 files changed, 45 insertions(+), 7 deletions(-)

New commits:
commit d491ae5692f0b1fb4653510e694bbf5227375858
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Oct 22 15:51:41 2015 +0200

    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

diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk
index a1f7125..ca9d8db 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 3e8544c..a75d230d 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();
commit 4c6db362dc31edaefd553860d1e0ef0be55c4862
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Oct 22 14:42:38 2015 +0200

    sc: implement vcl::ITiledRenderable::getWindow()
    
    Change-Id: If50b4b5baea36e161675afd368fc54bdec01d9a5

diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index f155888..3369cbe 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -412,6 +412,9 @@ public:
 
     /// @see lok::Document::resetSelection().
     virtual void resetSelection() override;
+
+    /// @see vcl::ITiledRenderable::getWindow().
+    virtual vcl::Window* getWindow() override;
 };
 
 class ScDrawPagesObj : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 3d3e7b7..cc10045 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -845,6 +845,17 @@ void ScModelObj::resetSelection()
     pDocShell->GetDocument().GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "");
 }
 
+vcl::Window* ScModelObj::getWindow()
+{
+    SolarMutexGuard aGuard;
+
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    if (!pViewData)
+        return 0;
+
+    return pViewData->GetActiveWin();
+}
+
 void ScModelObj::initializeForTiledRendering()
 {
     SolarMutexGuard aGuard;
commit 8522948ba2f30fb703d4725086d30d9aa2a0cf4c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Oct 22 14:15:14 2015 +0200

    sd: implement vcl::ITiledRenderable::getWindow()
    
    Change-Id: I8bc7316d9304d9e764ee846fe3af34599bf6fc35

diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index ded8f47e..0042826 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -259,6 +259,8 @@ public:
     virtual void setGraphicSelection(int nType, int nX, int nY) override;
     /// @see lok::Document::resetSelection().
     virtual void resetSelection() override;
+    /// @see vcl::ITiledRenderable::getWindow().
+    virtual vcl::Window* getWindow() override;
 
     // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 1fbb179..8580fea 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2533,6 +2533,17 @@ void SdXImpressDocument::resetSelection()
     pSdrView->UnmarkAll();
 }
 
+vcl::Window* SdXImpressDocument::getWindow()
+{
+    SolarMutexGuard aGuard;
+
+    DrawViewShell* pViewShell = GetViewShell();
+    if (!pViewShell)
+        return 0;
+
+    return pViewShell->GetActiveWindow();
+}
+
 uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
 {
     uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);


More information about the Libreoffice-commits mailing list