diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-04-01 16:06:27 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:15:19 -0300 |
commit | 2c2aa96d191135f68177df8029e891bcec56a39a (patch) | |
tree | 9d1e5329ab4893c561ba7c1ba46719d514725fc3 /tests/samplebinding/overload_test.py | |
parent | 009daead512428205ac730012d4d81ec49fc47e6 (diff) |
Expanded the tests that simulate QPainter::drawText even further.
The purpose of this is to provide more and more test cases for the
overload decisor.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'tests/samplebinding/overload_test.py')
-rw-r--r-- | tests/samplebinding/overload_test.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/samplebinding/overload_test.py b/tests/samplebinding/overload_test.py index 14a30c88b..e165ef854 100644 --- a/tests/samplebinding/overload_test.py +++ b/tests/samplebinding/overload_test.py @@ -116,6 +116,36 @@ class OverloadTest(unittest.TestCase): self.assertEqual(overload.drawText(1, 2, 3, 4, 5, Str()), Overload.Function6) self.assertEqual(overload.drawText(1, 2, 3, 4, 5, ''), Overload.Function6) + def testDrawText2IntIntIntIntStr(self): + overload = Overload() + self.assertEqual(overload.drawText2(1, 2, 3, 4, 5, Str()), Overload.Function6) + self.assertEqual(overload.drawText2(1, 2, 3, 4, 5, ''), Overload.Function6) + self.assertEqual(overload.drawText2(1, 2, 3, 4, 5), Overload.Function6) + self.assertEqual(overload.drawText2(1, 2, 3, 4), Overload.Function6) + self.assertEqual(overload.drawText2(1, 2, 3), Overload.Function6) + + def testDrawText3(self): + overload = Overload() + self.assertEqual(overload.drawText3(Str(), Str(), Str()), Overload.Function0) + self.assertEqual(overload.drawText3('', '', ''), Overload.Function0) + self.assertEqual(overload.drawText3(1, 2, 3, 4, 5), Overload.Function1) + self.assertEqual(overload.drawText3(1, 2, 3, 4, 5), Overload.Function1) + + def testDrawText3Exception(self): + overload = Overload() + # NOTE: Using 'try' because assertRaisesRegexp is not available. + # to check the error text. + try: + overload.drawText3(Str(), Str(), Str(), 4, 5) + except Exception as err: + self.assertEqual(type(err), TypeError) + self.assertTrue('called with wrong argument types:' in str(err)) + + def testDrawText4(self): + overload = Overload() + self.assertEqual(overload.drawText4(1, 2, 3), Overload.Function0) + self.assertEqual(overload.drawText4(1, 2, 3, 4, 5), Overload.Function1) + if __name__ == '__main__': unittest.main() |