Revert "tdf#158280 Replace usage of InputDialog with SvxNameDialog"
[LibreOffice.git] / sc / qa / extras / scindexenumeration_cellannotationsenumeration.cxx
blob5f12835d667bb559d50e300cd603c54dc5b4b63b
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/unoapi_test.hxx>
11 #include <test/container/xenumeration.hxx>
13 #include <com/sun/star/container/XEnumeration.hpp>
14 #include <com/sun/star/container/XEnumerationAccess.hpp>
15 #include <com/sun/star/container/XIndexAccess.hpp>
16 #include <com/sun/star/sheet/XSheetAnnotations.hpp>
17 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
18 #include <com/sun/star/sheet/XSpreadsheet.hpp>
19 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
20 #include <com/sun/star/sheet/XSpreadsheets.hpp>
21 #include <com/sun/star/table/CellAddress.hpp>
22 #include <com/sun/star/uno/XInterface.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
26 using namespace css;
27 using namespace css::uno;
29 namespace sc_apitest
31 class ScIndexEnumeration_CellAnnotationsEnumeration : public UnoApiTest,
32 public apitest::XEnumeration
34 public:
35 ScIndexEnumeration_CellAnnotationsEnumeration();
37 virtual uno::Reference<uno::XInterface> init() override;
38 virtual void setUp() override;
40 CPPUNIT_TEST_SUITE(ScIndexEnumeration_CellAnnotationsEnumeration);
42 // XEnumeration
43 CPPUNIT_TEST(testHasMoreElements);
44 CPPUNIT_TEST(testNextElement);
46 CPPUNIT_TEST_SUITE_END();
49 ScIndexEnumeration_CellAnnotationsEnumeration::ScIndexEnumeration_CellAnnotationsEnumeration()
50 : UnoApiTest(u"/sc/qa/extras/testdocuments"_ustr)
54 uno::Reference<uno::XInterface> ScIndexEnumeration_CellAnnotationsEnumeration::init()
56 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
57 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
59 uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_SET_THROW);
60 uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
61 uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
63 uno::Reference<sheet::XSheetAnnotationsSupplier> xSAS(xSheet0, uno::UNO_QUERY_THROW);
64 uno::Reference<sheet::XSheetAnnotations> xSA(xSAS->getAnnotations(), uno::UNO_SET_THROW);
65 xSA->insertNew(table::CellAddress(0, 5, 5), u"Note"_ustr);
67 uno::Reference<container::XEnumerationAccess> xEA(xSA, uno::UNO_QUERY_THROW);
68 uno::Reference<container::XEnumeration> xE(xEA->createEnumeration(), uno::UNO_SET_THROW);
70 return xEA->createEnumeration();
73 void ScIndexEnumeration_CellAnnotationsEnumeration::setUp()
75 UnoApiTest::setUp();
76 loadFromURL(u"private:factory/scalc"_ustr);
79 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_CellAnnotationsEnumeration);
81 } // namespace sc_apitest
83 CPPUNIT_PLUGIN_IMPLEMENT();
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */