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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 11 01:02:12 UTC 2019


 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv |    3 
 sc/CppunitTest_sc_stylefamilyobj.mk                              |   43 ++++
 sc/Module_sc.mk                                                  |    1 
 sc/qa/extras/scstylefamilyobj.cxx                                |   94 ++++++++++
 4 files changed, 138 insertions(+), 3 deletions(-)

New commits:
commit bb0948797d42cea9541651e0f90c2990ec5229b6
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Sun Mar 10 20:39:04 2019 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Mon Mar 11 02:01:49 2019 +0100

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

diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv
index d6178b16aa55..9e6efecdd398 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamilyObj.csv
@@ -1,6 +1,3 @@
-"ScStyleFamilyObj";"com::sun::star::container::XNameAccess";"getByName()"
-"ScStyleFamilyObj";"com::sun::star::container::XNameAccess";"getElementNames()"
-"ScStyleFamilyObj";"com::sun::star::container::XNameAccess";"hasByName()"
 "ScStyleFamilyObj";"com::sun::star::container::XNameReplace#optional";"replaceByName()"
 "ScStyleFamilyObj";"com::sun::star::container::XNameContainer#optional";"insertByName()"
 "ScStyleFamilyObj";"com::sun::star::container::XNameContainer#optional";"removeByName()"
diff --git a/sc/CppunitTest_sc_stylefamilyobj.mk b/sc/CppunitTest_sc_stylefamilyobj.mk
new file mode 100644
index 000000000000..99c49f9416ca
--- /dev/null
+++ b/sc/CppunitTest_sc_stylefamilyobj.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_stylefamilyobj))
+
+$(eval $(call gb_CppunitTest_use_external,sc_stylefamilyobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_stylefamilyobj, \
+	sc/qa/extras/scstylefamilyobj \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_stylefamilyobj, \
+	cppu \
+	sal \
+	subsequenttest \
+	test \
+	unotest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_stylefamilyobj,\
+	$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_stylefamilyobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_stylefamilyobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_stylefamilyobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_stylefamilyobj,\
+	$(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_stylefamilyobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 7d52583f95e4..58705a4cd32c 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -188,6 +188,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
 	CppunitTest_sc_spreadsheetsettings \
 	CppunitTest_sc_spreadsheetsettingsobj \
 	CppunitTest_sc_stylefamiliesobj \
+	CppunitTest_sc_stylefamilyobj \
 	CppunitTest_sc_subtotaldescriptorbaseobj \
 	CppunitTest_sc_subtotalfieldobj \
 	CppunitTest_sc_tableconditionalentryobj \
diff --git a/sc/qa/extras/scstylefamilyobj.cxx b/sc/qa/extras/scstylefamilyobj.cxx
new file mode 100644
index 000000000000..561d492abebf
--- /dev/null
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -0,0 +1,94 @@
+/* -*- 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/xnameaccess.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+
+namespace sc_apitest
+{
+class ScStyleFamilyObj : public CalcUnoApiTest, public apitest::XNameAccess
+{
+public:
+    ScStyleFamilyObj();
+
+    virtual uno::Reference<uno::XInterface> init() override;
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    CPPUNIT_TEST_SUITE(ScStyleFamilyObj);
+
+    // XNameAccess
+    CPPUNIT_TEST(testGetByName);
+    CPPUNIT_TEST(testGetElementNames);
+    CPPUNIT_TEST(testHasByName);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference<lang::XComponent> m_xComponent;
+};
+
+ScStyleFamilyObj::ScStyleFamilyObj()
+    : CalcUnoApiTest("/sc/qa/extras/testdocuemts")
+    , XNameAccess("Default")
+{
+}
+
+uno::Reference<uno::XInterface> ScStyleFamilyObj::init()
+{
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
+
+    uno::Reference<style::XStyleFamiliesSupplier> xSFS(xDoc, uno::UNO_QUERY_THROW);
+    uno::Reference<container::XNameAccess> xNA(xSFS->getStyleFamilies(), uno::UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIA(xNA, uno::UNO_QUERY_THROW);
+    uno::Reference<container::XNameAccess> xNA_SF(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
+
+    uno::Reference<lang::XMultiServiceFactory> xMSF(m_xComponent, uno::UNO_QUERY_THROW);
+    uno::Reference<uno::XInterface> xCS(xMSF->createInstance("com.sun.star.style.CellStyle"),
+                                        uno::UNO_QUERY_THROW);
+
+    uno::Reference<container::XNameContainer> xNC(xNA_SF, uno::UNO_QUERY_THROW);
+    xNC->insertByName("ScStyleFamilyObj", uno::makeAny(xCS));
+
+    return xNA_SF;
+}
+
+void ScStyleFamilyObj::setUp()
+{
+    CalcUnoApiTest::setUp();
+    // create calc document
+    m_xComponent = loadFromDesktop("private:factory/scalc");
+}
+
+void ScStyleFamilyObj::tearDown()
+{
+    closeDocument(m_xComponent);
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScStyleFamilyObj);
+
+} // 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