[Libreoffice-commits] core.git: 2 commits - pyuno/source toolkit/CppunitTest_toolkit.mk toolkit/qa
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 7 06:43:38 UTC 2020
pyuno/source/module/pyuno.cxx | 9 +++
pyuno/source/module/pyuno_callable.cxx | 9 +++
pyuno/source/module/pyuno_iterator.cxx | 20 ++++++--
pyuno/source/module/pyuno_runtime.cxx | 9 +++
pyuno/source/module/pyuno_struct.cxx | 9 +++
toolkit/CppunitTest_toolkit.mk | 1
toolkit/qa/cppunit/EventContainer.cxx | 82 +++++++++++++++++++++++++++++++++
7 files changed, 131 insertions(+), 8 deletions(-)
New commits:
commit d1786724b8e8e474e1f7e39012c1f19611841dc0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 6 18:43:30 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 7 08:43:14 2020 +0200
prevent warnings in pyuno with latest python
which has marked some members deprecated, but we can't stop initialising
them or we run the risk of ASAN complaining
Change-Id: I8f4ad0ae083fad9c040613ddde7c40f20d68c7d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93580
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index bdd717cc397e..1b875b6891d0 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1603,6 +1603,10 @@ static PyMappingMethods PyUNOMappingMethods[] =
PyUNO_setitem, /* mp_ass_subscript */
};
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyTypeObject PyUNOType =
{
PyVarObject_HEAD_INIT( &PyType_Type, 0 )
@@ -1661,11 +1665,14 @@ static PyTypeObject PyUNOType =
#if PY_VERSION_HEX >= 0x03080000
, nullptr // vectorcallfunc tp_vectorcall
#if PY_VERSION_HEX >= 0x03080200
- , 0 //Py_ssize_t tp_print
+ , nullptr //Py_ssize_t tp_print
#endif
#endif
#endif
};
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
int PyUNO_initType()
{
diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx
index 4803a30f814d..548c2bcef7dc 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -178,6 +178,10 @@ static PyObject* PyUNO_callable_call(
}
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyTypeObject PyUNO_callable_Type =
{
PyVarObject_HEAD_INIT( &PyType_Type, 0 )
@@ -236,11 +240,14 @@ static PyTypeObject PyUNO_callable_Type =
#if PY_VERSION_HEX >= 0x03080000
, nullptr // vectorcallfunc tp_vectorcall
#if PY_VERSION_HEX >= 0x03080200
- , 0 //Py_ssize_t tp_print
+ , nullptr //Py_ssize_t tp_print
#endif
#endif
#endif
};
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
PyRef PyUNO_callable_new (
const Reference<XInvocation2> &my_inv,
diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx
index 6ba7f96a9632..9258b780a304 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -110,7 +110,10 @@ static PyObject* PyUNO_iterator_next( PyObject *self )
return nullptr;
}
-
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyTypeObject PyUNO_iterator_Type =
{
PyVarObject_HEAD_INIT( &PyType_Type, 0 )
@@ -169,11 +172,14 @@ static PyTypeObject PyUNO_iterator_Type =
#if PY_VERSION_HEX >= 0x03080000
, nullptr // vectorcallfunc tp_vectorcall
#if PY_VERSION_HEX >= 0x03080200
- , 0 //Py_ssize_t tp_print
+ , nullptr //Py_ssize_t tp_print
#endif
#endif
#endif
};
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
PyObject* PyUNO_iterator_new( const Reference< XEnumeration >& xEnumeration )
{
@@ -250,7 +256,10 @@ static PyObject* PyUNO_list_iterator_next( PyObject *self )
return nullptr;
}
-
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyTypeObject PyUNO_list_iterator_Type =
{
PyVarObject_HEAD_INIT( &PyType_Type, 0 )
@@ -309,11 +318,14 @@ static PyTypeObject PyUNO_list_iterator_Type =
#if PY_VERSION_HEX >= 0x03080000
, nullptr // vectorcallfunc tp_vectorcall
#if PY_VERSION_HEX >= 0x03080200
- , 0 //Py_ssize_t tp_print
+ , nullptr //Py_ssize_t tp_print
#endif
#endif
#endif
};
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
PyObject* PyUNO_list_iterator_new( const Reference<XIndexAccess> &xIndexAccess )
{
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index ce7f36272f4b..a082907a1fac 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -70,6 +70,10 @@ using com::sun::star::beans::theIntrospection;
namespace pyuno
{
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyTypeObject RuntimeImpl_Type =
{
PyVarObject_HEAD_INIT (&PyType_Type, 0)
@@ -128,11 +132,14 @@ static PyTypeObject RuntimeImpl_Type =
#if PY_VERSION_HEX >= 0x03080000
, nullptr // vectorcallfunc tp_vectorcall
#if PY_VERSION_HEX >= 0x03080200
- , 0 //Py_ssize_t tp_print
+ , nullptr //Py_ssize_t tp_print
#endif
#endif
#endif
};
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
/*----------------------------------------------------------------------
Runtime implementation
diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx
index c816e1351c8c..27b24b1659ec 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -290,6 +290,10 @@ static PyMethodDef PyUNOStructMethods[] =
{nullptr, nullptr, 0, nullptr}
};
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyTypeObject PyUNOStructType =
{
PyVarObject_HEAD_INIT( &PyType_Type, 0 )
@@ -348,11 +352,14 @@ static PyTypeObject PyUNOStructType =
#if PY_VERSION_HEX >= 0x03080000
, nullptr // vectorcallfunc tp_vectorcall
#if PY_VERSION_HEX >= 0x03080200
- , 0 //Py_ssize_t tp_print
+ , nullptr //Py_ssize_t tp_print
#endif
#endif
#endif
};
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
int PyUNOStruct_initType()
{
commit 4021fedf758b8c4c439387c61223acd78630cedc
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed May 6 16:32:12 2020 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu May 7 08:43:03 2020 +0200
Test keeping element order in EventContainer
Change-Id: Ic33d8a83305f70bb3eb60f44da0d9ac0d2b47e16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93570
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/toolkit/CppunitTest_toolkit.mk b/toolkit/CppunitTest_toolkit.mk
index 5afa7a616188..496ed0d7bac0 100644
--- a/toolkit/CppunitTest_toolkit.mk
+++ b/toolkit/CppunitTest_toolkit.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,toolkit))
$(eval $(call gb_CppunitTest_add_exception_objects,toolkit, \
toolkit/qa/cppunit/Dialog \
+ toolkit/qa/cppunit/EventContainer \
toolkit/qa/cppunit/UnitConversion \
))
diff --git a/toolkit/qa/cppunit/EventContainer.cxx b/toolkit/qa/cppunit/EventContainer.cxx
new file mode 100644
index 000000000000..300c8e5adb74
--- /dev/null
+++ b/toolkit/qa/cppunit/EventContainer.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/bootstrapfixture.hxx>
+
+#include <com/sun/star/awt/UnoControlDialog.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/script/XScriptEventsSupplier.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::awt;
+using namespace css::container;
+using namespace css::lang;
+using namespace css::script;
+using namespace css::uno;
+
+namespace
+{
+/// Test EventContainer class
+class EventContainerTest : public test::BootstrapFixture
+{
+protected:
+ Reference<XComponentContext> mxContext;
+
+public:
+ virtual void setUp() override;
+};
+
+void EventContainerTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
+}
+
+// Make sure that EventContainer keeps insertion order, and does not reorder its elements.
+// Otherwise this would break macro signatures.
+CPPUNIT_TEST_FIXTURE(EventContainerTest, testInsertOrder)
+{
+ Reference<XMultiComponentFactory> xFactory(mxContext->getServiceManager(), UNO_SET_THROW);
+ Reference<XControlModel> xControlModel(
+ xFactory->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext),
+ UNO_QUERY_THROW);
+
+ Reference<beans::XPropertySet> xPropSet(xControlModel, UNO_QUERY_THROW);
+
+ Reference<XScriptEventsSupplier> xEventsSupplier(xPropSet, UNO_QUERY_THROW);
+ Reference<XNameContainer> xEvents(xEventsSupplier->getEvents(), UNO_SET_THROW);
+ script::ScriptEventDescriptor descr1;
+ script::ScriptEventDescriptor descr2;
+ script::ScriptEventDescriptor descr3;
+ script::ScriptEventDescriptor descr4;
+ xEvents->insertByName("b", makeAny(descr1));
+ xEvents->insertByName("a", makeAny(descr2));
+ xEvents->insertByName("1", makeAny(descr3));
+ xEvents->insertByName("A", makeAny(descr4));
+
+ Sequence<OUString> aEventNames(xEvents->getElementNames());
+ sal_Int32 nEventCount = aEventNames.getLength();
+ CPPUNIT_ASSERT_EQUAL(4, nEventCount);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("b"), aEventNames[0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("a"), aEventNames[1]);
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), aEventNames[2]);
+ CPPUNIT_ASSERT_EQUAL(OUString("A"), aEventNames[3]);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list