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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 15 17:29:54 UTC 2019


 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamiliesObj.csv |    3 
 sc/CppunitTest_sc_stylefamiliesobj.mk                              |   43 +++++
 sc/Module_sc.mk                                                    |    1 
 sc/qa/extras/scstylefamiliesobj.cxx                                |   85 ++++++++++
 4 files changed, 129 insertions(+), 3 deletions(-)

New commits:
commit babb947e4c23240bf63acbf6657384f0e2c982bd
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Tue Jan 15 06:57:53 2019 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Tue Jan 15 18:29:30 2019 +0100

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

diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamiliesObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamiliesObj.csv
index 485343e08110..85d5bff7b77f 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamiliesObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScStyleFamiliesObj.csv
@@ -1,6 +1,3 @@
-"ScStyleFamiliesObj";"com::sun::star::container::XNameAccess";"getByName()"
-"ScStyleFamiliesObj";"com::sun::star::container::XNameAccess";"getElementNames()"
-"ScStyleFamiliesObj";"com::sun::star::container::XNameAccess";"hasByName()"
 "ScStyleFamiliesObj";"com::sun::star::container::XIndexAccess#optional";"getCount()"
 "ScStyleFamiliesObj";"com::sun::star::container::XIndexAccess#optional";"getByIndex()"
 "ScStyleFamiliesObj";"com::sun::star::container::XElementAccess";"getElementType()"
diff --git a/sc/CppunitTest_sc_stylefamiliesobj.mk b/sc/CppunitTest_sc_stylefamiliesobj.mk
new file mode 100644
index 000000000000..7c9a5f5a3d76
--- /dev/null
+++ b/sc/CppunitTest_sc_stylefamiliesobj.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_stylefamiliesobj))
+
+$(eval $(call gb_CppunitTest_use_external,sc_stylefamiliesobj,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_stylefamiliesobj, \
+    sc/qa/extras/scstylefamiliesobj \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_stylefamiliesobj, \
+	cppu \
+	sal \
+	subsequenttest \
+	test \
+	unotest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_stylefamiliesobj,\
+	$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_stylefamiliesobj))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_stylefamiliesobj))
+$(eval $(call gb_CppunitTest_use_vcl,sc_stylefamiliesobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_stylefamiliesobj,\
+    $(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_stylefamiliesobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 84ab0d759596..dab235dbf863 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -177,6 +177,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
 	CppunitTest_sc_sortdescriptorbaseobj \
 	CppunitTest_sc_spreadsheetsettings \
 	CppunitTest_sc_spreadsheetsettingsobj \
+	CppunitTest_sc_stylefamiliesobj \
 	CppunitTest_sc_styleloaderobj \
 	CppunitTest_sc_subtotaldescriptorbaseobj \
 	CppunitTest_sc_subtotalfieldobj \
diff --git a/sc/qa/extras/scstylefamiliesobj.cxx b/sc/qa/extras/scstylefamiliesobj.cxx
new file mode 100644
index 000000000000..1a1135d1db7a
--- /dev/null
+++ b/sc/qa/extras/scstylefamiliesobj.cxx
@@ -0,0 +1,85 @@
+/* -*- 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/XNameAccess.hpp>
+#include <com/sun/star/lang/XComponent.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;
+using namespace css::uno;
+
+namespace sc_apitest
+{
+class ScStyleFamiliesObj : public CalcUnoApiTest, public apitest::XNameAccess
+{
+public:
+    ScStyleFamiliesObj();
+
+    virtual uno::Reference<uno::XInterface> init() override;
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    CPPUNIT_TEST_SUITE(ScStyleFamiliesObj);
+
+    // XNameAccess
+    CPPUNIT_TEST(testGetByName);
+    CPPUNIT_TEST(testGetElementNames);
+    CPPUNIT_TEST(testHasByName);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference<lang::XComponent> m_xComponent;
+};
+
+ScStyleFamiliesObj::ScStyleFamiliesObj()
+    : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+    , XNameAccess("CellStyles")
+{
+}
+
+uno::Reference<uno::XInterface> ScStyleFamiliesObj::init()
+{
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
+    uno::Reference<style::XStyleFamiliesSupplier> xSFS(xDoc, uno::UNO_QUERY_THROW);
+    uno::Reference<container::XNameAccess> xNA(xSFS->getStyleFamilies(), uno::UNO_QUERY_THROW);
+
+    return xNA;
+}
+
+void ScStyleFamiliesObj::setUp()
+{
+    CalcUnoApiTest::setUp();
+    // create a calc document
+    m_xComponent = loadFromDesktop("private:factory/scalc");
+    CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
+}
+
+void ScStyleFamiliesObj::tearDown()
+{
+    closeDocument(m_xComponent);
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScStyleFamiliesObj);
+
+} // 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