Blob Blame History Raw
From 578ff092c9726fb2fd18b1a21a5846855a641508 Mon Sep 17 00:00:00 2001
From: Mihai Varga <mihai.varga@collabora.com>
Date: Wed, 9 Sep 2015 15:08:26 +0300
Subject: [PATCH 103/398] LOK: moved the decalaration of LibLODocument_Impl to
 make it visible

We needed a better way to test LOK methods that are not app specific,
but are defined in /desktop/source/lib/init.cxx. So the decalaration
needs to be visible.

I also moved the `getStyles` test in the new test file

Change-Id: I98d97dc17a66e72732ca7bd848c131610790f48e
(cherry picked from commit 2290efa4a22d42cd9099b63b9138e4ff994c07f9)
---
 desktop/CppunitTest_desktop_lib.mk          |  68 ++++++++++++++++
 desktop/Module_desktop.mk                   |   4 +
 desktop/inc/lib/init.hxx                    |  27 +++++++
 desktop/qa/data/blank_text.odt              | Bin 0 -> 8295 bytes
 desktop/qa/desktop_lib/test_desktop_lib.cxx | 116 ++++++++++++++++++++++++++++
 desktop/source/lib/init.cxx                 |  79 +++++++++----------
 libreofficekit/qa/unit/tiledrendering.cxx   |  34 --------
 7 files changed, 252 insertions(+), 76 deletions(-)
 create mode 100644 desktop/CppunitTest_desktop_lib.mk
 create mode 100644 desktop/inc/lib/init.hxx
 create mode 100644 desktop/qa/data/blank_text.odt
 create mode 100644 desktop/qa/desktop_lib/test_desktop_lib.cxx

diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk
new file mode 100644
index 000000000000..be394600ddf0
--- /dev/null
+++ b/desktop/CppunitTest_desktop_lib.mk
@@ -0,0 +1,68 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,desktop_lib))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,desktop_lib, \
+	desktop/qa/desktop_lib/test_desktop_lib \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
+	comphelper \
+	cppu \
+	cppuhelper \
+	sal \
+	sfx \
+	sofficeapp \
+	subsequenttest \
+	sw \
+	test \
+	unotest \
+	vcl \
+    $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_external,desktop_lib,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_api,desktop_lib,\
+	offapi \
+	udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,desktop_lib))
+
+$(eval $(call gb_CppunitTest_use_vcl,desktop_lib))
+
+$(eval $(call gb_CppunitTest_use_components,desktop_lib,\
+    comphelper/util/comphelp \
+    configmgr/source/configmgr \
+    filter/source/config/cache/filterconfig1 \
+    filter/source/storagefilterdetect/storagefd \
+    framework/util/fwk \
+    i18npool/util/i18npool \
+    package/source/xstor/xstor \
+    package/util/package2 \
+    sax/source/expatwrap/expwrap \
+    sfx2/util/sfx \
+    svl/source/fsstor/fsstorage \
+    svtools/util/svt \
+    sw/util/sw \
+    sw/util/swd \
+    toolkit/util/tk \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+    unoxml/source/service/unoxml \
+    xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,desktop_lib))
+
+# vim: set noet sw=4 ts=4:
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index ab04152731ce..c725a268721e 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -130,4 +130,8 @@ $(eval $(call gb_Module_add_check_targets,desktop, \
     CppunitTest_desktop_version \
 ))
 
+$(eval $(call gb_Module_add_check_targets,desktop, \
+    CppunitTest_desktop_lib \
+))
+
 # vim: set ts=4 sw=4 et:
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
new file mode 100644
index 000000000000..b17f82566daf
--- /dev/null
+++ b/desktop/inc/lib/init.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#include <LibreOfficeKit/LibreOfficeKit.h>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <boost/shared_ptr.hpp>
+#include "../../source/inc/desktopdllapi.h"
+
+using namespace css;
+using namespace boost;
+
+namespace desktop {
+    struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument
+    {
+        uno::Reference<css::lang::XComponent> mxComponent;
+        shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass;
+
+        explicit LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent);
+        ~LibLODocument_Impl();
+    };
+}
diff --git a/desktop/qa/data/blank_text.odt b/desktop/qa/data/blank_text.odt
new file mode 100644
index 0000000000000000000000000000000000000000..00b92d785acd15b68c927aa3b2f1a5d3f1614425
GIT binary patch
literal 8295
zcmeHMbzD^4)*hNsQc^-jKmmy%1rd-Ak(8lp=$L__8>A5dW28Gpx)G!i6qJrZIz_ru
zg>QK8^~KkV_s{RIyXJS8eTMTqXV-f6UVEu3Vqud50QdkvlH{qhVLLAY3jhE(yU;%Y
z;MQ<+XAguq6oG(Qn?jwf?d`y>c4l1mP$z3AE_;NzoteF<3*6k!nakPS-C6Y?WGF;v
z{|F`kaCT9n$uz87;3jrZYnT(*`Dc*}VQ2YRRauVk63r#_BZLa_((35%b^rhafRDxj
zEbpaI0RWh(3epl9?n!I?r9c2TK~o9Q(doi2P%2%X%6)Tn-M_nzXj(9a(Spt7e}Deh
z2mk-`fGSrD_oOVdwFf<80SYq8(nXTS0sry_e0==BT<h#VKkYKQU}|sYeC9Xqa9E+1
zf&CbW+-It|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ial}
z4I^v>?69%02$7O0QtyY(i>Y3v#W9eYG!<+$PFfZx*puNJWg_%GqO%ObbL4qRwImDb
zY>gtOaur|Rs&KB_BrY(r72#i_*J5!K<=h|ffGNec$S@WK_tS9958|ai#BU@%us3uQ
z3ynjFPj?_hA=IDPx8{gPy#G=y`bRrDbZEB|!#<mE7?|XMKd1Q4Cgr*PO!)nd`aPF-
zj!;4u|CHJL$?|h>e?7E4%YmGm9$FxN$%y<8{57UO6Weophx^YH-rteG29AF@;@{9o
zG!Z(x`PT`+@2Fp8|179Hw{oIiL(JcCzv|sT>&cGJV*Wja(M!Zn<V9X~ribTdgLa<Z
zb>TnM@t<RS4*r)up5MQ^fb3Vb{4>v)UY^_31w8*$&wnxf9QiZkPYFEJ&vUza^*@{U
z2Q~d~eRifW=Z3g|^ju5-+{iP1JGYz*Sbo*kKlA*vHj@|doNMi$S^ilYa`f%*^WazQ
z{WH%$YxCd&o^vh!7t7CK`&CHJ)cD*2&@2~fv#KHv+9d%1QuGIb)}I;Lv%CKTSWiMf

literal 0
HcmV?d00001

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
new file mode 100644
index 000000000000..c88a53f41edb
--- /dev/null
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+
+#include <boost/property_tree/json_parser.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/objsh.hxx>
+#include <test/unoapi_test.hxx>
+
+#include "../../inc/lib/init.hxx"
+
+using namespace com::sun::star;
+using namespace desktop;
+
+class DesktopLOKTest : public UnoApiTest
+{
+public:
+    DesktopLOKTest() : UnoApiTest("/desktop/qa/data/")
+    {
+    }
+
+    virtual ~DesktopLOKTest()
+    {
+    }
+
+    virtual void setUp() SAL_OVERRIDE
+    {
+        UnoApiTest::setUp();
+        mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+    };
+
+    virtual void tearDown() SAL_OVERRIDE
+    {
+        closeDoc();
+        UnoApiTest::tearDown();
+    };
+
+    LibLODocument_Impl* loadDoc(const char* pName);
+    void closeDoc();
+
+    void runAllTests();
+    void testGetStyles();
+
+    CPPUNIT_TEST_SUITE(DesktopLOKTest);
+    CPPUNIT_TEST(runAllTests);
+    CPPUNIT_TEST_SUITE_END();
+
+    uno::Reference<lang::XComponent> mxComponent;
+};
+
+LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName)
+{
+    OUString aFileURL;
+    createFileURL(OUString::createFromAscii(pName), aFileURL);
+    mxComponent = loadFromDesktop(aFileURL, "com.sun.star.text.TextDocument");
+    if (!mxComponent.is())
+    {
+        CPPUNIT_ASSERT(false);
+    }
+    return new LibLODocument_Impl(mxComponent);
+}
+
+void DesktopLOKTest::closeDoc()
+{
+    if (mxComponent.is())
+    {
+        closeDocument(mxComponent);
+        mxComponent.clear();
+    }
+}
+
+void DesktopLOKTest::runAllTests()
+{
+    testGetStyles();
+}
+
+void DesktopLOKTest::testGetStyles()
+{
+    LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+    boost::property_tree::ptree aTree;
+    char* pJSON = pDocument->m_pDocumentClass->getStyles(pDocument);
+    std::stringstream aStream(pJSON);
+    boost::property_tree::read_json(aStream, aTree);
+    CPPUNIT_ASSERT( aTree.size() > 0 );
+
+    for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aTree)
+    {
+        CPPUNIT_ASSERT( rPair.second.size() > 0);
+        if (rPair.first != "CharacterStyles" &&
+            rPair.first != "ParagraphStyles" &&
+            rPair.first != "FrameStyles" &&
+            rPair.first != "PageStyles" &&
+            rPair.first != "NumberingStyles" &&
+            rPair.first != "CellStyles" &&
+            rPair.first != "ShapeStyles")
+        {
+            CPPUNIT_FAIL("Unknown style family: " + rPair.first);
+        }
+    }
+    closeDoc();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c7f3aabb58b7..a20decd3afbe 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -64,6 +64,7 @@
 // We also need to hackily be able to start the main libreoffice thread:
 #include "../app/sofficemain.h"
 #include "../app/officeipcthread.hxx"
+#include "../../inc/lib/init.hxx"
 
 using namespace css;
 using namespace vcl;
@@ -72,7 +73,6 @@ using namespace utl;
 
 using namespace boost;
 
-struct LibLODocument_Impl;
 struct LibLibreOffice_Impl;
 
 static LibLibreOffice_Impl *gImpl = NULL;
@@ -237,51 +237,46 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis,
 static void doc_resetSelection (LibreOfficeKitDocument* pThis);
 static char* doc_getStyles(LibreOfficeKitDocument* pThis);
 
-struct LibLODocument_Impl : public _LibreOfficeKitDocument
-{
-    uno::Reference<css::lang::XComponent> mxComponent;
-    shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass;
 
-    explicit LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) :
-        mxComponent( xComponent )
+LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) :
+    mxComponent( xComponent )
+{
+    if (!(m_pDocumentClass = gDocumentClass.lock()))
     {
-        if (!(m_pDocumentClass = gDocumentClass.lock()))
-        {
-            m_pDocumentClass.reset(new LibreOfficeKitDocumentClass);
-
-            m_pDocumentClass->nSize = sizeof(LibreOfficeKitDocument);
-
-            m_pDocumentClass->destroy = doc_destroy;
-            m_pDocumentClass->saveAs = doc_saveAs;
-            m_pDocumentClass->getDocumentType = doc_getDocumentType;
-            m_pDocumentClass->getParts = doc_getParts;
-            m_pDocumentClass->getPart = doc_getPart;
-            m_pDocumentClass->setPart = doc_setPart;
-            m_pDocumentClass->getPartName = doc_getPartName;
-            m_pDocumentClass->setPartMode = doc_setPartMode;
-            m_pDocumentClass->paintTile = doc_paintTile;
-            m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
-            m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
-            m_pDocumentClass->registerCallback = doc_registerCallback;
-            m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
-            m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
-            m_pDocumentClass->postUnoCommand = doc_postUnoCommand;
-            m_pDocumentClass->setTextSelection = doc_setTextSelection;
-            m_pDocumentClass->getTextSelection = doc_getTextSelection;
-            m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
-            m_pDocumentClass->resetSelection = doc_resetSelection;
-            m_pDocumentClass->getStyles = doc_getStyles;
-
-            gDocumentClass = m_pDocumentClass;
-        }
-        pClass = m_pDocumentClass.get();
+        m_pDocumentClass.reset(new LibreOfficeKitDocumentClass);
+
+        m_pDocumentClass->nSize = sizeof(LibreOfficeKitDocument);
+
+        m_pDocumentClass->destroy = doc_destroy;
+        m_pDocumentClass->saveAs = doc_saveAs;
+        m_pDocumentClass->getDocumentType = doc_getDocumentType;
+        m_pDocumentClass->getParts = doc_getParts;
+        m_pDocumentClass->getPart = doc_getPart;
+        m_pDocumentClass->setPart = doc_setPart;
+        m_pDocumentClass->getPartName = doc_getPartName;
+        m_pDocumentClass->setPartMode = doc_setPartMode;
+        m_pDocumentClass->paintTile = doc_paintTile;
+        m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
+        m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
+        m_pDocumentClass->registerCallback = doc_registerCallback;
+        m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
+        m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
+        m_pDocumentClass->postUnoCommand = doc_postUnoCommand;
+        m_pDocumentClass->setTextSelection = doc_setTextSelection;
+        m_pDocumentClass->getTextSelection = doc_getTextSelection;
+        m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
+        m_pDocumentClass->resetSelection = doc_resetSelection;
+        m_pDocumentClass->getStyles = doc_getStyles;
+
+        gDocumentClass = m_pDocumentClass;
     }
+    pClass = m_pDocumentClass.get();
+}
 
-    ~LibLODocument_Impl()
-    {
-        mxComponent->dispose();
-    }
-};
+LibLODocument_Impl::~LibLODocument_Impl()
+{
+    mxComponent->dispose();
+}
 
 static void doc_destroy(LibreOfficeKitDocument *pThis)
 {
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index a0f4bcb5b8eb..aa68c724f0f3 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -68,7 +68,6 @@ public:
     void testDocumentTypes( Office* pOffice );
     void testImpressSlideNames( Office* pOffice );
     void testCalcSheetNames( Office* pOffice );
-    void testGetStyles( Office* pOffice );
 #if 0
     void testOverlay( Office* pOffice );
 #endif
@@ -95,7 +94,6 @@ void TiledRenderingTest::runAllTests()
     testDocumentTypes( pOffice.get() );
     testImpressSlideNames( pOffice.get() );
     testCalcSheetNames( pOffice.get() );
-    testGetStyles( pOffice.get() );
 #if 0
     testOverlay( pOffice.get() );
 #endif
@@ -184,38 +182,6 @@ void TiledRenderingTest::testCalcSheetNames( Office* pOffice )
     CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 2 ), "Sheet3" ) == 0 );
 }
 
-void TiledRenderingTest::testGetStyles( Office* pOffice )
-{
-    const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_text.odt";
-    const string sLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_text.odt#";
-
-    // FIXME: LOK will fail when trying to open a locked file
-    remove( sLockFile.c_str() );
-
-    scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) );
-
-    boost::property_tree::ptree aTree;
-    char* pJSON = pDocument->getStyles();
-    std::stringstream aStream(pJSON);
-    boost::property_tree::read_json(aStream, aTree);
-    CPPUNIT_ASSERT( aTree.size() > 0 );
-
-    for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aTree)
-    {
-        CPPUNIT_ASSERT( rPair.second.size() > 0);
-        if (rPair.first != "CharacterStyles" &&
-            rPair.first != "ParagraphStyles" &&
-            rPair.first != "FrameStyles" &&
-            rPair.first != "PageStyles" &&
-            rPair.first != "NumberingStyles" &&
-            rPair.first != "CellStyles" &&
-            rPair.first != "ShapeStyles")
-        {
-            CPPUNIT_FAIL("Unknown style family: " + rPair.first);
-        }
-    }
-}
-
 #if 0
 static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
                             const int nWidth, const int nHeight )
-- 
2.12.0