aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-08-10 16:10:10 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:10 -0300
commitc7713d00f71e96f33ca25e2152cbec8907dcf80e (patch)
treefa57ff2f6e7f012c29dd488a0d02816a7ab0bcb3
parenta1a8ea866cb039854190da70332717e816908d65 (diff)
Implemented unit test for deprecated functions.
Reviewer: Hugo Parente <hugo.lima@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--tests/libsample/objecttype.h3
-rw-r--r--tests/samplebinding/deprecated_test.py49
-rw-r--r--tests/samplebinding/typesystem_sample.xml1
3 files changed, 53 insertions, 0 deletions
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h
index 5cc029e85..f032a09f8 100644
--- a/tests/libsample/objecttype.h
+++ b/tests/libsample/objecttype.h
@@ -121,6 +121,9 @@ public:
m_parent = 0;
}
+ //Deprecated test
+ bool deprecatedFunction() { return true; }
+
private:
ObjectType(const ObjectType&);
ObjectType& operator=(const ObjectType&);
diff --git a/tests/samplebinding/deprecated_test.py b/tests/samplebinding/deprecated_test.py
new file mode 100644
index 000000000..f9607d0db
--- /dev/null
+++ b/tests/samplebinding/deprecated_test.py
@@ -0,0 +1,49 @@
+#!/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
+
+import warnings
+import unittest
+
+from sample import ObjectType
+
+class TestDeprecatedCall(unittest.TestCase):
+ """
+ def setUp(self):
+ warnings.simplefilter("default")
+
+ def testCallWithoutError(self):
+ o = ObjectType()
+ self.assertTrue(o.deprecatedFunction())
+ """
+
+ def testCallWithError(self):
+ o = ObjectType()
+ warnings.simplefilter("error")
+ self.assertRaises(DeprecationWarning, o.deprecatedFunction)
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 4f1d5481b..0209aedd4 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -205,6 +205,7 @@
</object-type>
<object-type name="ObjectType" hash-function="objectTypeHash">
+ <modify-function signature="deprecatedFunction()" deprecated="yes" />
<!-- rename function to avoid Python signature conflit -->
<modify-function signature="setObject(const Null&amp;)" rename="setNullObject" />