diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-10-15 17:17:35 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:07:21 -0300 |
commit | 894d7c725bc103919d38a6a491852e8cfc255d7d (patch) | |
tree | 3248ee2f00c4d8e566f695fc2a5402bfd4488cd0 /tests/samplebinding/pointf_test.py | |
parent | dc18b27491b45577fe2868382f0f645a4127387b (diff) |
Added test for overload decisor handling container dependencies.
Explaining with an example. Consider a function called "function" with
two signatures accepting a list of Point and a list of PointF,
respectively. Consider also that Point is implicitly convertible to
PointF.
void function(list<Point>&)
void function(list<PointF>&)
A list of Point should be checked before a list of PointF.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/samplebinding/pointf_test.py')
-rw-r--r-- | tests/samplebinding/pointf_test.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/samplebinding/pointf_test.py b/tests/samplebinding/pointf_test.py new file mode 100644 index 000000000..f9aac9f20 --- /dev/null +++ b/tests/samplebinding/pointf_test.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# This file is part of the Shiboken Python Bindings Generator project. +# +# Copyright (C) 2010 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 PointF class''' + +import unittest + +from sample import PointF + +class PointFTest(unittest.TestCase): + '''Test case for PointF class, including operator overloads.''' + + def testConstructor(self): + '''Test PointF class constructor.''' + pt = PointF(5.0, 2.3) + self.assertEqual(pt.x(), 5.0) + self.assertEqual(pt.y(), 2.3) + + def testPlusOperator(self): + '''Test PointF class + operator.''' + pt1 = PointF(5.0, 2.3) + pt2 = PointF(0.5, 3.2) + self.assertEqual(pt1 + pt2, PointF(5.0 + 0.5, 2.3 + 3.2)) + + def testEqualOperator(self): + '''Test PointF class == operator.''' + pt1 = PointF(5.0, 2.3) + pt2 = PointF(5.0, 2.3) + pt3 = PointF(0.5, 3.2) + self.assertTrue(pt1 == pt1) + self.assertTrue(pt1 == pt2) + self.assertFalse(pt1 == pt3) + +if __name__ == '__main__': + unittest.main() + |