From b5a18440f45d8218dbdd76d76f7fd1e54d352712 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Jan 2017 19:33:05 +0000 Subject: Extend unit test with code similar to kguiaddons --- tests/GenerateSipBindings/cpplib.cpp | 5 +++++ tests/GenerateSipBindings/cpplib.h | 8 ++++++++ tests/GenerateSipBindings/testscript.py | 7 +++++++ 3 files changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/GenerateSipBindings/cpplib.cpp b/tests/GenerateSipBindings/cpplib.cpp index c5b7a5fb..76b97b0e 100644 --- a/tests/GenerateSipBindings/cpplib.cpp +++ b/tests/GenerateSipBindings/cpplib.cpp @@ -141,3 +141,8 @@ void MyObject::privateSlot2() { Q_EMIT privateSlotCalled(); } + +qreal SomeNS::useEnum(MyFlags flags) +{ + return flags; +} diff --git a/tests/GenerateSipBindings/cpplib.h b/tests/GenerateSipBindings/cpplib.h index 6ec3f575..ba8e9f27 100644 --- a/tests/GenerateSipBindings/cpplib.h +++ b/tests/GenerateSipBindings/cpplib.h @@ -116,6 +116,14 @@ private: int* const mNum; }; +enum MyFlagType { + EnumValueOne = 0x01, + EnumValueTwo = 0x02 +}; +Q_DECLARE_FLAGS(MyFlags, MyFlagType) + +qreal useEnum(MyFlags flags = EnumValueOne); + } enum __attribute__((visibility("default"))) EnumWithAttributes { diff --git a/tests/GenerateSipBindings/testscript.py b/tests/GenerateSipBindings/testscript.py index 973d428c..deefb960 100644 --- a/tests/GenerateSipBindings/testscript.py +++ b/tests/GenerateSipBindings/testscript.py @@ -91,3 +91,10 @@ assert(r.gotProtectedSlotCalledSignal) e.emitSignalForPublic() assert(r.gotPublicSlotCalledSignal) + +assert(PyTest.CppLib.SomeNS.EnumValueOne == 1) +assert(PyTest.CppLib.SomeNS.EnumValueTwo == 2) + +assert(PyTest.CppLib.SomeNS.useEnum() == 1.0) +assert(PyTest.CppLib.SomeNS.useEnum(PyTest.CppLib.SomeNS.EnumValueOne) == 1.0) +assert(PyTest.CppLib.SomeNS.useEnum(PyTest.CppLib.SomeNS.EnumValueTwo) == 2.0) -- cgit v1.2.1