summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-11-13 15:24:11 -0800
committerJens Carl <j.carl43@gmx.de>2018-11-14 03:50:27 +0100
commit13dd6c26658727ec72b6fa2f7129a0e283ff1ec6 (patch)
tree37a16e19a2e70a47849e89d5d765d577422b37ac /sc
parent85dba18a3d3644a4ac49bd32ea106a4d69159fb4 (diff)
tdf#45904 Move _XEnumeration for ScCellsEnumeration to C++
Change-Id: Ic7c8e6a9fe777d16a98da89e00f1f52128ac1b5d Reviewed-on: https://gerrit.libreoffice.org/63351 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/CppunitTest_sc_cellsenumeration.mk43
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/qa/extras/sccellsenumeration.cxx105
-rw-r--r--sc/qa/unoapi/sc_3.sce1
4 files changed, 149 insertions, 1 deletions
diff --git a/sc/CppunitTest_sc_cellsenumeration.mk b/sc/CppunitTest_sc_cellsenumeration.mk
new file mode 100644
index 000000000000..892370b74f6c
--- /dev/null
+++ b/sc/CppunitTest_sc_cellsenumeration.mk
@@ -0,0 +1,43 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# 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/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_cellsenumeration))
+
+$(eval $(call gb_CppunitTest_use_external,sc_cellsenumeration,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellsenumeration, \
+ sc/qa/extras/sccellsenumeration \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_cellsenumeration, \
+ cppu \
+ sal \
+ subsequenttest \
+ test \
+ unotest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_cellsenumeration,\
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_cellsenumeration))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_cellsenumeration))
+$(eval $(call gb_CppunitTest_use_vcl,sc_cellsenumeration))
+
+$(eval $(call gb_CppunitTest_use_components,sc_cellsenumeration,\
+ $(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_cellsenumeration))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index b6730d613549..be0d64347c4f 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -112,6 +112,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_cellobj \
CppunitTest_sc_cellrangeobj \
CppunitTest_sc_cellrangesobj \
+ CppunitTest_sc_cellsenumeration \
CppunitTest_sc_chart2dataprovider \
CppunitTest_sc_check_data_pilot_field \
CppunitTest_sc_check_data_pilot_table \
diff --git a/sc/qa/extras/sccellsenumeration.cxx b/sc/qa/extras/sccellsenumeration.cxx
new file mode 100644
index 000000000000..2cc420a87887
--- /dev/null
+++ b/sc/qa/extras/sccellsenumeration.cxx
@@ -0,0 +1,105 @@
+/* -*- 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/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sheet/XCellRangesQuery.hpp>
+#include <com/sun/star/sheet/XSheetCellRanges.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheets.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace sc_apitest
+{
+class ScCellsEnumeration : public CalcUnoApiTest, public apitest::XEnumeration
+{
+public:
+ ScCellsEnumeration();
+
+ virtual uno::Reference<uno::XInterface> init() override;
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ CPPUNIT_TEST_SUITE(ScCellsEnumeration);
+
+ // XEnumeration
+ CPPUNIT_TEST(testHasMoreElements);
+ CPPUNIT_TEST(testNextElement);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference<lang::XComponent> m_xComponent;
+};
+
+ScCellsEnumeration::ScCellsEnumeration()
+ : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
+uno::Reference<uno::XInterface> ScCellsEnumeration::init()
+{
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
+ uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
+
+ uno::Reference<table::XCellRange> xCellRange(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<table::XCell> xCell0(xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xTextRange0(xCell0, uno::UNO_QUERY_THROW);
+ xTextRange0->setString("Test string 1");
+
+ uno::Reference<table::XCell> xCell1(xCellRange->getCellByPosition(5, 1), uno::UNO_QUERY_THROW);
+ xCell1->setValue(15);
+
+ uno::Reference<table::XCell> xCell2(xCellRange->getCellByPosition(3, 9), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xTextRange1(xCell2, uno::UNO_QUERY_THROW);
+ xTextRange1->setString("Test string 2");
+
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(xCellRange, uno::UNO_QUERY_THROW);
+ uno::Reference<sheet::XSheetCellRanges> xSCR(xCellRangesQuery->queryVisibleCells(),
+ uno::UNO_QUERY_THROW);
+
+ return xSCR->getCells()->createEnumeration();
+}
+
+void ScCellsEnumeration::setUp()
+{
+ CalcUnoApiTest::setUp();
+ m_xComponent = loadFromDesktop("private:factory/scalc");
+ CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
+}
+
+void ScCellsEnumeration::tearDown()
+{
+ closeDocument(m_xComponent);
+ CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScCellsEnumeration);
+
+} // 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_3.sce b/sc/qa/unoapi/sc_3.sce
index ba1f28f1746a..a32b6e907168 100644
--- a/sc/qa/unoapi/sc_3.sce
+++ b/sc/qa/unoapi/sc_3.sce
@@ -19,7 +19,6 @@
-o sc.ScCellRangesObj
-o sc.ScCellSearchObj
-o sc.ScCellTextCursor
--o sc.ScCellsEnumeration
-o sc.ScCellsObj
-o sc.ScChartObj
-o sc.ScChartsObj