diff options
author | Jens Carl <j.carl43@gmx.de> | 2018-11-18 06:48:48 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2018-11-18 08:59:30 +0100 |
commit | 7ff004e8cac9b3e7296da11fc634facdadcd4d59 (patch) | |
tree | b41bcfb766fee3d02421d5775ccd4049de5adae5 /sc/qa | |
parent | 986217f02de979b84c62843ae93db120e267abac (diff) |
tdf#45904 Move XEnumeration Java tests to C++
Move XEnumeration Java tests to C++
for ScIndexEnumeration_LabelRangesEnumeration.
Change-Id: I89c24de2323a2507fd5c1639af72c6b7121e77c9
Reviewed-on: https://gerrit.libreoffice.org/63516
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/extras/scindexenumeration_labelrangesenumeration.cxx | 92 | ||||
-rw-r--r-- | sc/qa/unoapi/sc_5.sce | 1 |
2 files changed, 92 insertions, 1 deletions
diff --git a/sc/qa/extras/scindexenumeration_labelrangesenumeration.cxx b/sc/qa/extras/scindexenumeration_labelrangesenumeration.cxx new file mode 100644 index 000000000000..16ecba28da57 --- /dev/null +++ b/sc/qa/extras/scindexenumeration_labelrangesenumeration.cxx @@ -0,0 +1,92 @@ +/* -*- 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/calc_unoapi_test.hxx> +#include <test/container/xenumeration.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/sheet/XLabelRanges.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; +using namespace css::uno; + +namespace sc_apitest +{ +class ScIndexEnumeration_LabelRangesEnumeration : public CalcUnoApiTest, + public apitest::XEnumeration +{ +public: + ScIndexEnumeration_LabelRangesEnumeration(); + + virtual uno::Reference<uno::XInterface> init() override; + virtual void setUp() override; + virtual void tearDown() override; + + CPPUNIT_TEST_SUITE(ScIndexEnumeration_LabelRangesEnumeration); + + // XEnumeration + CPPUNIT_TEST(testHasMoreElements); + CPPUNIT_TEST(testNextElement); + + CPPUNIT_TEST_SUITE_END(); + +private: + uno::Reference<lang::XComponent> m_xComponent; +}; + +ScIndexEnumeration_LabelRangesEnumeration::ScIndexEnumeration_LabelRangesEnumeration() + : CalcUnoApiTest("/sc/qa/extras/testdocuments") +{ +} + +uno::Reference<uno::XInterface> ScIndexEnumeration_LabelRangesEnumeration::init() +{ + uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); + + uno::Reference<beans::XPropertySet> xPropertySet(xDoc, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XLabelRanges> xLR; + CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ColumnLabelRanges") >>= xLR); + + xLR->addNew(table::CellRangeAddress(0, 0, 1, 0, 6), table::CellRangeAddress(0, 0, 0, 0, 1)); + + uno::Reference<container::XEnumerationAccess> xEA(xLR, uno::UNO_QUERY_THROW); + + return xEA->createEnumeration(); +} + +void ScIndexEnumeration_LabelRangesEnumeration::setUp() +{ + CalcUnoApiTest::setUp(); + m_xComponent = loadFromDesktop("private:factory/scalc"); + CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is()); +} + +void ScIndexEnumeration_LabelRangesEnumeration::tearDown() +{ + closeDocument(m_xComponent); + CalcUnoApiTest::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_LabelRangesEnumeration); + +} // namespace sc_apitest + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/qa/unoapi/sc_5.sce b/sc/qa/unoapi/sc_5.sce index 09b55f2bb0a7..41b9b126171d 100644 --- a/sc/qa/unoapi/sc_5.sce +++ b/sc/qa/unoapi/sc_5.sce @@ -18,7 +18,6 @@ -o sc.ScIndexEnumeration_DataPilotItemsEnumeration -o sc.ScIndexEnumeration_DatabaseRangesEnumeration -o sc.ScIndexEnumeration_FunctionDescriptionEnumeration --o sc.ScIndexEnumeration_LabelRangesEnumeration -o sc.ScIndexEnumeration_NamedRangesEnumeration -o sc.ScIndexEnumeration_SheetCellRangesEnumeration -o sc.ScIndexEnumeration_SpreadsheetViewPanesEnumeration |