[Libreoffice-commits] core.git: include/test sc/qa test/Library_subsequenttest.mk test/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 18 07:42:04 UTC 2019


 include/test/sheet/xddelinks.hxx |   44 +++++++++++++++++++++++++++++++++++++++
 sc/qa/extras/scddelinksobj.cxx   |    6 +++++
 test/Library_subsequenttest.mk   |    1 
 test/source/sheet/xddelinks.cxx  |   41 ++++++++++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+)

New commits:
commit eee8c16a5c541fd355e7e6fe3b25c3f36d2f6eb8
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Thu Jan 17 23:25:30 2019 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Fri Jan 18 08:41:38 2019 +0100

    Add XDDELinks tests to ScDDELinksObj
    
    Change-Id: I9e6efbd5a1cd9e4787e8143dd4f8adbe6ab2cae7
    Reviewed-on: https://gerrit.libreoffice.org/66561
    Tested-by: Jenkins
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/include/test/sheet/xddelinks.hxx b/include/test/sheet/xddelinks.hxx
new file mode 100644
index 000000000000..8ceb07cdd39e
--- /dev/null
+++ b/include/test/sheet/xddelinks.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XDDELINKS_HXX
+#define INCLUDED_TEST_SHEET_XDDELINKS_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDDELinks
+{
+public:
+    XDDELinks(const OUString& rTopic)
+        : m_aTopic(rTopic)
+    {
+    }
+
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testAddDDELink();
+
+protected:
+    ~XDDELinks() {}
+
+private:
+    OUString const m_aTopic;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XDDELINKS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sc/qa/extras/scddelinksobj.cxx b/sc/qa/extras/scddelinksobj.cxx
index 721478ba839d..bc62f4cfbc2d 100644
--- a/sc/qa/extras/scddelinksobj.cxx
+++ b/sc/qa/extras/scddelinksobj.cxx
@@ -13,6 +13,7 @@
 #include <test/container/xindexaccess.hxx>
 #include <test/container/xnameaccess.hxx>
 #include <test/lang/xserviceinfo.hxx>
+#include <test/sheet/xddelinks.hxx>
 
 #include <cppu/unotype.hxx>
 #include <rtl/ustring.hxx>
@@ -38,6 +39,7 @@ using namespace com::sun::star;
 namespace sc_apitest
 {
 class ScDDELinksObj : public CalcUnoApiTest,
+                      public apitest::XDDELinks,
                       public apitest::XElementAccess,
                       public apitest::XEnumerationAccess,
                       public apitest::XIndexAccess,
@@ -53,6 +55,9 @@ public:
 
     CPPUNIT_TEST_SUITE(ScDDELinksObj);
 
+    // XDDELinks
+    CPPUNIT_TEST(testAddDDELink);
+
     // XElementAccess
     CPPUNIT_TEST(testGetElementType);
     CPPUNIT_TEST(testHasElements);
@@ -82,6 +87,7 @@ private:
 
 ScDDELinksObj::ScDDELinksObj()
     : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+    , XDDELinks(m_directories.getURLFromSrc("/sc/qa/unoapi/testdocuments/ScDDELinksObj.ods"))
     , XElementAccess(cppu::UnoType<sheet::XDDELink>::get())
     , XIndexAccess(1)
     , XNameAccess("soffice|"
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 081763980f95..43c4593efaca 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -103,6 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/sheet/xdatapilottables \
 	test/source/sheet/xdatapilottablessupplier \
 	test/source/sheet/xddelink \
+	test/source/sheet/xddelinks \
 	test/source/sheet/xdocumentauditing \
 	test/source/sheet/xformulaquery \
 	test/source/sheet/xfunctiondescriptions \
diff --git a/test/source/sheet/xddelinks.cxx b/test/source/sheet/xddelinks.cxx
new file mode 100644
index 000000000000..1115a29b828b
--- /dev/null
+++ b/test/source/sheet/xddelinks.cxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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 <test/sheet/xddelinks.hxx>
+
+#include <com/sun/star/sheet/DDELinkMode.hpp>
+#include <com/sun/star/sheet/XDDELink.hpp>
+#include <com/sun/star/sheet/XDDELinks.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XDDELinks::testAddDDELink()
+{
+    uno::Reference<sheet::XDDELinks> xLinks(init(), UNO_QUERY_THROW);
+
+    uno::Reference<sheet::XDDELink> xLink
+        = xLinks->addDDELink("soffice", m_aTopic, "Sheet1.A1", sheet::DDELinkMode_DEFAULT);
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getApplication()", OUString("soffice"),
+                                 xLink->getApplication());
+    CPPUNIT_ASSERT_MESSAGE("Unable to execute getTopic()",
+                           xLink->getTopic().endsWith("ScDDELinksObj.ods"));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getItem()", OUString("Sheet1.A1"),
+                                 xLink->getItem());
+}
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list