From a66352996264d7dfbbe68df179421a8e0ef3637a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 May 2018 17:11:57 +0200 Subject: Fix wrongly generated code for enums passed by const-ref First encountered in: QtScxmlEvent::setEventType(const EventType &); The metatype was wrongly detected as NativePointerPattern in AbstractMetaType::determineUsagePattern(). Introduce a helper for detecting plain const-ref and use that consistently. Change-Id: I6b105bc99ae63e4737c5d628e79f23b7acbcca3d Reviewed-by: Alexandru Croitor --- sources/shiboken2/tests/samplebinding/enum_test.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sources/shiboken2/tests/samplebinding/enum_test.py') diff --git a/sources/shiboken2/tests/samplebinding/enum_test.py b/sources/shiboken2/tests/samplebinding/enum_test.py index 0a5a84c4a..7e1cac8c0 100644 --- a/sources/shiboken2/tests/samplebinding/enum_test.py +++ b/sources/shiboken2/tests/samplebinding/enum_test.py @@ -115,6 +115,14 @@ class EnumTest(unittest.TestCase): sum = Event.EventTypeClass.Value1 + Event.EventTypeClass.Value2 self.assertEqual(sum, 1) + def testSetEnum(self): + event = Event(Event.ANY_EVENT) + self.assertEqual(event.eventType(), Event.ANY_EVENT) + event.setEventType(Event.BASIC_EVENT) + self.assertEqual(event.eventType(), Event.BASIC_EVENT) + event.setEventTypeByConstRef(Event.SOME_EVENT) + self.assertEqual(event.eventType(), Event.SOME_EVENT) + def testEnumTpPrintImplementation(self): '''Without SbkEnum.tp_print 'print' returns the enum represented as an int.''' tmpfile = createTempFile() -- cgit v1.2.3