summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2019-04-19 07:47:12 +0000
committerJens Carl <j.carl43@gmx.de>2019-04-20 21:41:19 +0200
commit2b307927f028eeefcec41a8bc8daae392521f9df (patch)
tree60f0b7122547e3665970aacdebf035843e6650a4 /sc
parent003d11f410b7e515981b3efbd65d936d94d87121 (diff)
tdf#45904 Move XCellRange Java test to C++
mOve XCellRange Java test to C++ for ScTableColumnObj. Change-Id: I165e5752fb679be6790c305a99f35da644e17d56 Reviewed-on: https://gerrit.libreoffice.org/70968 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/CppunitTest_sc_tablecolumnobj.mk43
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/qa/extras/sctablecolumnobj.cxx90
3 files changed, 134 insertions, 0 deletions
diff --git a/sc/CppunitTest_sc_tablecolumnobj.mk b/sc/CppunitTest_sc_tablecolumnobj.mk
new file mode 100644
index 000000000000..6f18e8070285
--- /dev/null
+++ b/sc/CppunitTest_sc_tablecolumnobj.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_tablecolumnobj))
+
+$(eval $(call gb_CppunitTest_use_external,sc_tablecolumnobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_tablecolumnobj, \
+ sc/qa/extras/sctablecolumnobj \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_tablecolumnobj, \
+ cppu \
+ sal \
+ subsequenttest \
+ test \
+ unotest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_tablecolumnobj,\
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_tablecolumnobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_tablecolumnobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_tablecolumnobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_tablecolumnobj,\
+ $(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_tablecolumnobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 8a7484a824dd..633fa010982e 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -194,6 +194,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_stylefamilyobj \
CppunitTest_sc_subtotaldescriptorbase \
CppunitTest_sc_subtotalfieldobj \
+ CppunitTest_sc_tablecolumnobj \
CppunitTest_sc_tablecolumnsobj \
CppunitTest_sc_tableconditionalentryobj \
CppunitTest_sc_tableconditionalformat \
diff --git a/sc/qa/extras/sctablecolumnobj.cxx b/sc/qa/extras/sctablecolumnobj.cxx
new file mode 100644
index 000000000000..9a8b8c79e556
--- /dev/null
+++ b/sc/qa/extras/sctablecolumnobj.cxx
@@ -0,0 +1,90 @@
+/* -*- 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/table/xcellrange.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheets.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/table/XTableColumns.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+
+namespace sc_apitest
+{
+class ScTableColumnObj : public CalcUnoApiTest, public apitest::XCellRange
+{
+public:
+ ScTableColumnObj();
+
+ virtual uno::Reference<uno::XInterface> init() override;
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ CPPUNIT_TEST_SUITE(ScTableColumnObj);
+
+ // XCellRange
+ CPPUNIT_TEST(testGetCellByPosition);
+ CPPUNIT_TEST(testGetCellRangeByName);
+ CPPUNIT_TEST(testGetCellRangeByPosition);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference<lang::XComponent> m_xComponent;
+};
+
+ScTableColumnObj::ScTableColumnObj()
+ : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+ , XCellRange("K1:K1")
+{
+}
+
+uno::Reference<uno::XInterface> ScTableColumnObj::init()
+{
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<table::XColumnRowRange> xCRR(xSheet0, uno::UNO_QUERY_THROW);
+ uno::Reference<table::XTableColumns> xTC(xCRR->getColumns(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<container::XIndexAccess> xIA_TC(xTC, uno::UNO_QUERY_THROW);
+ uno::Reference<uno::XInterface> xReturn(xIA_TC->getByIndex(10), uno::UNO_QUERY_THROW);
+ return xReturn;
+}
+
+void ScTableColumnObj::setUp()
+{
+ CalcUnoApiTest::setUp();
+ // create calc document
+ m_xComponent = loadFromDesktop("private:factory/scalc");
+}
+
+void ScTableColumnObj::tearDown()
+{
+ closeDocument(m_xComponent);
+ CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTableColumnObj);
+
+} // namespace sc_apitest
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */