Kaydet (Commit) eee8c16a authored tarafından Jens Carl's avatar Jens Carl

Add XDDELinks tests to ScDDELinksObj

Change-Id: I9e6efbd5a1cd9e4787e8143dd4f8adbe6ab2cae7
Reviewed-on: https://gerrit.libreoffice.org/66561
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst ec4a2826
/* -*- 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: */
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <test/container/xindexaccess.hxx> #include <test/container/xindexaccess.hxx>
#include <test/container/xnameaccess.hxx> #include <test/container/xnameaccess.hxx>
#include <test/lang/xserviceinfo.hxx> #include <test/lang/xserviceinfo.hxx>
#include <test/sheet/xddelinks.hxx>
#include <cppu/unotype.hxx> #include <cppu/unotype.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
...@@ -38,6 +39,7 @@ using namespace com::sun::star; ...@@ -38,6 +39,7 @@ using namespace com::sun::star;
namespace sc_apitest namespace sc_apitest
{ {
class ScDDELinksObj : public CalcUnoApiTest, class ScDDELinksObj : public CalcUnoApiTest,
public apitest::XDDELinks,
public apitest::XElementAccess, public apitest::XElementAccess,
public apitest::XEnumerationAccess, public apitest::XEnumerationAccess,
public apitest::XIndexAccess, public apitest::XIndexAccess,
...@@ -53,6 +55,9 @@ public: ...@@ -53,6 +55,9 @@ public:
CPPUNIT_TEST_SUITE(ScDDELinksObj); CPPUNIT_TEST_SUITE(ScDDELinksObj);
// XDDELinks
CPPUNIT_TEST(testAddDDELink);
// XElementAccess // XElementAccess
CPPUNIT_TEST(testGetElementType); CPPUNIT_TEST(testGetElementType);
CPPUNIT_TEST(testHasElements); CPPUNIT_TEST(testHasElements);
...@@ -82,6 +87,7 @@ private: ...@@ -82,6 +87,7 @@ private:
ScDDELinksObj::ScDDELinksObj() ScDDELinksObj::ScDDELinksObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuments") : CalcUnoApiTest("/sc/qa/extras/testdocuments")
, XDDELinks(m_directories.getURLFromSrc("/sc/qa/unoapi/testdocuments/ScDDELinksObj.ods"))
, XElementAccess(cppu::UnoType<sheet::XDDELink>::get()) , XElementAccess(cppu::UnoType<sheet::XDDELink>::get())
, XIndexAccess(1) , XIndexAccess(1)
, XNameAccess("soffice|" , XNameAccess("soffice|"
......
...@@ -103,6 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ ...@@ -103,6 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xdatapilottables \ test/source/sheet/xdatapilottables \
test/source/sheet/xdatapilottablessupplier \ test/source/sheet/xdatapilottablessupplier \
test/source/sheet/xddelink \ test/source/sheet/xddelink \
test/source/sheet/xddelinks \
test/source/sheet/xdocumentauditing \ test/source/sheet/xdocumentauditing \
test/source/sheet/xformulaquery \ test/source/sheet/xformulaquery \
test/source/sheet/xfunctiondescriptions \ test/source/sheet/xfunctiondescriptions \
......
/* -*- 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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment