[Libreoffice-commits] core.git: qadevOOo/objdsc sc/CppunitTest_sc_tablerowsobj.mk sc/Module_sc.mk sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 18 23:32:45 UTC 2018


 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableRowsObj.csv |    2 
 sc/CppunitTest_sc_tablerowsobj.mk                              |   43 ++++
 sc/Module_sc.mk                                                |    1 
 sc/qa/extras/sctablerowsobj.cxx                                |   90 ++++++++++
 4 files changed, 134 insertions(+), 2 deletions(-)

New commits:
commit 9b39fcd59c251e51c074e90f48924849b6f2f5c7
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Tue Dec 18 19:55:09 2018 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Wed Dec 19 00:32:21 2018 +0100

    tdf#45904 Move XIndexAccess Java tests to C++
    
    Move XIndexAccess Java tests to C++ for ScTableRowsObj.
    
    Change-Id: I90dc592ba7901dab9c402b56e9e992fe7593c71c
    Reviewed-on: https://gerrit.libreoffice.org/65371
    Tested-by: Jenkins
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableRowsObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableRowsObj.csv
index 5fc9e5772b15..c73b20a6ef30 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableRowsObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableRowsObj.csv
@@ -1,5 +1,3 @@
-"ScTableRowsObj";"com::sun::star::container::XIndexAccess";"getCount()"
-"ScTableRowsObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
 "ScTableRowsObj";"com::sun::star::container::XElementAccess";"getElementType()"
 "ScTableRowsObj";"com::sun::star::container::XElementAccess";"hasElements()"
 "ScTableRowsObj";"com::sun::star::table::XTableRows";"insertByIndex()"
diff --git a/sc/CppunitTest_sc_tablerowsobj.mk b/sc/CppunitTest_sc_tablerowsobj.mk
new file mode 100644
index 000000000000..34d4b2b8c250
--- /dev/null
+++ b/sc/CppunitTest_sc_tablerowsobj.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_tablerowsobj))
+
+$(eval $(call gb_CppunitTest_use_external,sc_tablerowsobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_tablerowsobj, \
+    sc/qa/extras/sctablerowsobj \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_tablerowsobj, \
+	cppu \
+	sal \
+	subsequenttest \
+	test \
+	unotest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_tablerowsobj,\
+	$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_tablerowsobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_tablerowsobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_tablerowsobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_tablerowsobj,\
+    $(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_tablerowsobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 95bfd089dd13..97a5e17bca3b 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -182,6 +182,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
 	CppunitTest_sc_subtotalfieldobj \
 	CppunitTest_sc_tableconditionalentryobj \
 	CppunitTest_sc_tableconditionalformatobj \
+	CppunitTest_sc_tablerowsobj \
 	CppunitTest_sc_tablesheetobj \
 	CppunitTest_sc_tablesheetsobj \
 	CppunitTest_sc_tablevalidationobj \
diff --git a/sc/qa/extras/sctablerowsobj.cxx b/sc/qa/extras/sctablerowsobj.cxx
new file mode 100644
index 000000000000..67c1f86efafc
--- /dev/null
+++ b/sc/qa/extras/sctablerowsobj.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/container/xindexaccess.hxx>
+
+#include <com/sun/star/container/XNameAccess.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/XTableRows.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace sc_apitest
+{
+class ScTableRowsObj : public CalcUnoApiTest, public apitest::XIndexAccess
+{
+public:
+    ScTableRowsObj();
+
+    virtual uno::Reference<uno::XInterface> init() override;
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    CPPUNIT_TEST_SUITE(ScTableRowsObj);
+
+    // XIndexAccess
+    CPPUNIT_TEST(testGetByIndex);
+    CPPUNIT_TEST(testGetCount);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference<lang::XComponent> m_xCompoment;
+};
+
+ScTableRowsObj::ScTableRowsObj()
+    : CalcUnoApiTest("/sc/qa/extras/testdocuemts")
+    , XIndexAccess(1048576)
+{
+}
+
+uno::Reference<uno::XInterface> ScTableRowsObj::init()
+{
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xCompoment, 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::XNameAccess> xNA(xSheets, uno::UNO_QUERY_THROW);
+    uno::Reference<sheet::XSpreadsheet> xSheet0(xSheets->getByName(xNA->getElementNames()[0]),
+                                                uno::UNO_QUERY_THROW);
+
+    uno::Reference<table::XColumnRowRange> xCRR(xSheet0, uno::UNO_QUERY_THROW);
+    uno::Reference<table::XTableRows> xTR(xCRR->getRows(), uno::UNO_QUERY_THROW);
+
+    return xTR;
+}
+
+void ScTableRowsObj::setUp()
+{
+    CalcUnoApiTest::setUp();
+    m_xCompoment = loadFromDesktop("private:factory/scalc");
+    CPPUNIT_ASSERT_MESSAGE("no component", m_xCompoment.is());
+}
+
+void ScTableRowsObj::tearDown()
+{
+    closeDocument(m_xCompoment);
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTableRowsObj);
+} // namespace sc_apitest
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list