aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qtcore
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-12-28 16:41:50 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-01-04 15:58:39 -0200
commit7729b390d0b8ca82192158cae3865e31b0365573 (patch)
treed15881b78e309f0fba4b1422f4051cd7d5a4a380 /tests/qtcore
parent85048bbd6c5d4231f71852cab18fd581c5068141 (diff)
Fixes type system templates for methods with bool* as parameter.
Template functions like "fix_bool*" were converting the bool "ok" value to various types except bool, and "fix_bool*,arg" was using the wrong C++ argument. Tests were also added. Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'tests/qtcore')
-rw-r--r--tests/qtcore/qstring_test.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/qtcore/qstring_test.py b/tests/qtcore/qstring_test.py
index 35863a16b..d9152447d 100644
--- a/tests/qtcore/qstring_test.py
+++ b/tests/qtcore/qstring_test.py
@@ -9,10 +9,25 @@ import sys
from PySide.QtCore import QString, QByteArray
class QStringToNumber(unittest.TestCase):
+ def testReturnValueTypes(self):
+ obj = QString('37')
+ val, ok = obj.toInt()
+ self.assertEqual(type(val), int)
+ self.assertEqual(type(ok), bool)
+
def testToNumberInt(self):
obj = QString('37')
self.assertEqual(37, obj.toInt()[0])
+ def testToNumberIntUsingHex(self):
+ obj = QString('2A')
+ self.assertEquals((0, False), obj.toInt())
+ self.assertEqual((int(str(obj), 16), True), obj.toInt(16))
+
+ def testToNumberIntUsingHex(self):
+ obj = QString('101010')
+ self.assertEqual((int(str(obj), 2), True), obj.toInt(2))
+
def testToNumberFloat(self):
obj = QString('37.109')
self.assertEqual(ctypes.c_float(37.109).value,