aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/libsample/CMakeLists.txt1
-rw-r--r--tests/libsample/overload.cpp56
-rw-r--r--tests/libsample/overload.h65
-rw-r--r--tests/samplebinding/CMakeLists.txt1
-rw-r--r--tests/samplebinding/global.h1
-rwxr-xr-xtests/samplebinding/overload_test.py66
-rw-r--r--tests/samplebinding/typesystem_sample.xml3
7 files changed, 193 insertions, 0 deletions
diff --git a/tests/libsample/CMakeLists.txt b/tests/libsample/CMakeLists.txt
index 869b95b47..227951672 100644
--- a/tests/libsample/CMakeLists.txt
+++ b/tests/libsample/CMakeLists.txt
@@ -11,6 +11,7 @@ listuser.cpp
modifications.cpp
mapuser.cpp
multiple_derived.cpp
+overload.cpp
pairuser.cpp
point.cpp
reference.cpp
diff --git a/tests/libsample/overload.cpp b/tests/libsample/overload.cpp
new file mode 100644
index 000000000..23ff560c1
--- /dev/null
+++ b/tests/libsample/overload.cpp
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation. Please
+ * review the following information to ensure the GNU Lesser General
+ * Public License version 2.1 requirements will be met:
+ * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ *
+ * As a special exception to the GNU Lesser General Public License
+ * version 2.1, the object code form of a "work that uses the Library"
+ * may incorporate material from a header file that is part of the
+ * Library. You may distribute such object code under terms of your
+ * choice, provided that the incorporated material (i) does not exceed
+ * more than 5% of the total size of the Library; and (ii) is limited to
+ * numerical parameters, data structure layouts, accessors, macros,
+ * inline functions and templates.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "overload.h"
+
+Overload::FunctionEnum Overload::overloaded()
+{
+ return Function0;
+}
+
+Overload::FunctionEnum Overload::overloaded(Size* size)
+{
+ return Function1;
+}
+
+Overload::FunctionEnum Overload::overloaded(Point* point, ParamEnum param)
+{
+ return Function2;
+}
+
+Overload::FunctionEnum Overload::overloaded(const Point& point)
+{
+ return Function3;
+}
+
diff --git a/tests/libsample/overload.h b/tests/libsample/overload.h
new file mode 100644
index 000000000..fe2b1811a
--- /dev/null
+++ b/tests/libsample/overload.h
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation. Please
+ * review the following information to ensure the GNU Lesser General
+ * Public License version 2.1 requirements will be met:
+ * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ *
+ * As a special exception to the GNU Lesser General Public License
+ * version 2.1, the object code form of a "work that uses the Library"
+ * may incorporate material from a header file that is part of the
+ * Library. You may distribute such object code under terms of your
+ * choice, provided that the incorporated material (i) does not exceed
+ * more than 5% of the total size of the Library; and (ii) is limited to
+ * numerical parameters, data structure layouts, accessors, macros,
+ * inline functions and templates.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef OVERLOAD_H
+#define OVERLOAD_H
+
+#include "size.h"
+#include "point.h"
+
+class Overload
+{
+public:
+ enum FunctionEnum {
+ Function0,
+ Function1,
+ Function2,
+ Function3
+ };
+
+ enum ParamEnum {
+ Param0,
+ Param1
+ };
+
+ Overload() {}
+ virtual ~Overload() {}
+
+ FunctionEnum overloaded();
+ FunctionEnum overloaded(Size* size);
+ FunctionEnum overloaded(Point* point, ParamEnum param);
+ FunctionEnum overloaded(const Point& point);
+};
+#endif // OVERLOAD_H
+
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt
index 4e53c84a1..ed876ec7d 100644
--- a/tests/samplebinding/CMakeLists.txt
+++ b/tests/samplebinding/CMakeLists.txt
@@ -17,6 +17,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/modifications_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/mapuser_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/nondefaultctor_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/oddbooluser_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/sample/overload_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/pairuser_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/point_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/privatedtor_wrapper.cpp
diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h
index 19aa1fe64..413ff92a7 100644
--- a/tests/samplebinding/global.h
+++ b/tests/samplebinding/global.h
@@ -9,6 +9,7 @@
#include "listuser.h"
#include "mapuser.h"
#include "multiple_derived.h"
+#include "overload.h"
#include "samplenamespace.h"
#include "simplefile.h"
#include "modifications.h"
diff --git a/tests/samplebinding/overload_test.py b/tests/samplebinding/overload_test.py
new file mode 100755
index 000000000..f7d7c0756
--- /dev/null
+++ b/tests/samplebinding/overload_test.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# This file is part of the Shiboken Python Bindings Generator project.
+#
+# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+#
+# Contact: PySide team <contact@pyside.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# version 2.1 as published by the Free Software Foundation. Please
+# review the following information to ensure the GNU Lesser General
+# Public License version 2.1 requirements will be met:
+# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+# #
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+'''Test cases for Overload class'''
+
+import sys
+import unittest
+
+from sample import Overload, Point, Size
+
+class OVerloadTest(unittest.TestCase):
+ '''Test case for Overload class'''
+
+ def testOverloadMethod0(self):
+ '''Check overloaded method calling for signature "overloaded()".'''
+ overload = Overload()
+ result = overload.overloaded()
+ self.assertEqual(result, Overload.Function0)
+
+ def testOverloadMethod1(self):
+ '''Check overloaded method calling for signature "overloaded(Size*)".'''
+ overload = Overload()
+ size = Size()
+ result = overload.overloaded(size)
+ self.assertEqual(result, Overload.Function1)
+
+ def testOverloadMethod2(self):
+ '''Check overloaded method calling for signature "overloaded(Point*, ParamEnum)".'''
+ overload = Overload()
+ point = Point()
+ result = overload.overloaded(point, Overload.Param1)
+ self.assertEqual(result, Overload.Function2)
+
+ def testOverloadMethod3(self):
+ '''Check overloaded method calling for signature "overloaded(const Point&)".'''
+ overload = Overload()
+ point = Point()
+ result = overload.overloaded(point)
+ self.assertEqual(result, Overload.Function3)
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 7461ce2c0..f8185c6c8 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -45,6 +45,8 @@
<enum-type name="SampleNamespace::OutValue"/>
<enum-type name="GlobalEnum"/>
<enum-type name="GlobalOverloadFuncEnum"/>
+ <enum-type name="Overload::FunctionEnum"/>
+ <enum-type name="Overload::ParamEnum"/>
<namespace-type name="SampleNamespace"/>
@@ -231,6 +233,7 @@
<value-type name="ListUser"/>
<value-type name="NonDefaultCtor" />
<value-type name="OddBoolUser" />
+ <value-type name="Overload" />
<value-type name="SimpleFile">
<modify-function signature="open()">