nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / scindexenumeration_ddelinksenumeration.cxx
blobda64bc9a1c35967c3df85cdb9022fa397951516d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <test/calc_unoapi_test.hxx>
11 #include <test/container/xenumeration.hxx>
13 #include <com/sun/star/beans/XPropertySet.hpp>
14 #include <com/sun/star/container/XEnumerationAccess.hpp>
15 #include <com/sun/star/container/XIndexAccess.hpp>
16 #include <com/sun/star/lang/XComponent.hpp>
17 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
18 #include <com/sun/star/sheet/XSpreadsheet.hpp>
19 #include <com/sun/star/sheet/XSpreadsheets.hpp>
20 #include <com/sun/star/uno/XInterface.hpp>
22 #include <com/sun/star/uno/Reference.hxx>
24 #include <sal/types.h>
26 using namespace css;
27 using namespace css::uno;
29 namespace sc_apitest
31 class ScIndexEnumeration_DDELinksEnumeration : public CalcUnoApiTest, public apitest::XEnumeration
33 public:
34 ScIndexEnumeration_DDELinksEnumeration();
36 virtual uno::Reference<uno::XInterface> init() override;
37 virtual void setUp() override;
38 virtual void tearDown() override;
40 CPPUNIT_TEST_SUITE(ScIndexEnumeration_DDELinksEnumeration);
42 // XEnumeration
43 CPPUNIT_TEST(testHasMoreElements);
44 CPPUNIT_TEST(testNextElement);
46 CPPUNIT_TEST_SUITE_END();
48 private:
49 uno::Reference<lang::XComponent> m_xComponent;
52 ScIndexEnumeration_DDELinksEnumeration::ScIndexEnumeration_DDELinksEnumeration()
53 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
57 uno::Reference<uno::XInterface> ScIndexEnumeration_DDELinksEnumeration::init()
59 uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
60 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
62 uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_SET_THROW);
63 uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
64 uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
66 xSheet0->getCellByPosition(5, 5)->setFormula(
67 "=DDE(\"soffice\";\"ScDDELinksObj.ods\";\"Sheet1.A1\"");
68 xSheet0->getCellByPosition(1, 4)->setFormula(
69 "=DDE(\"soffice\";\"ScDDELinksObj.ods\";\"Sheet1.A1\"");
70 xSheet0->getCellByPosition(2, 0)->setFormula(
71 "=DDE(\"soffice\";\"ScDDELinksObj.ods\";\"Sheet1.A1\"");
73 uno::Reference<beans::XPropertySet> xPropertySet(xDoc, uno::UNO_QUERY_THROW);
75 uno::Reference<container::XEnumerationAccess> xEA(xPropertySet->getPropertyValue("DDELinks"),
76 uno::UNO_QUERY_THROW);
77 return xEA->createEnumeration();
80 void ScIndexEnumeration_DDELinksEnumeration::setUp()
82 CalcUnoApiTest::setUp();
83 m_xComponent = loadFromDesktop("private:factory/scalc");
84 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
87 void ScIndexEnumeration_DDELinksEnumeration::tearDown()
89 closeDocument(m_xComponent);
90 CalcUnoApiTest::tearDown();
93 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_DDELinksEnumeration);
95 } // namespace sc_apitest
97 CPPUNIT_PLUGIN_IMPLEMENT();
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */