diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2009-09-21 14:51:26 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2009-09-21 14:52:09 -0300 |
commit | 9af36fbb64f19842c0cc797c0b586b3a686805e8 (patch) | |
tree | 6bbc050ded0f85517ea75f5dc6dc1ed172168248 /tests/qtcore/qobject_test.py | |
parent | aa12538d63685ef8f75adaa79411b751929b727d (diff) |
Added all original pyside unit tests to the shiboken version.
Diffstat (limited to 'tests/qtcore/qobject_test.py')
-rw-r--r-- | tests/qtcore/qobject_test.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/qtcore/qobject_test.py b/tests/qtcore/qobject_test.py new file mode 100644 index 000000000..848cce361 --- /dev/null +++ b/tests/qtcore/qobject_test.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +'''Test cases for QObject methods''' + +import unittest + +from PySide.QtCore import QObject + +class ObjectNameCase(unittest.TestCase): + '''Tests related to QObject object name''' + + def testSimple(self): + #QObject.objectName(string) + name = 'object1' + obj = QObject() + obj.setObjectName(name) + + self.assertEqual(name, obj.objectName()) + + def testEmpty(self): + #QObject.objectName('') + name = '' + obj = QObject() + obj.setObjectName(name) + + self.assertEqual(name, obj.objectName()) + + def testNone(self): + #QObject.objectName(None) + obj = QObject() + + self.assertRaises(TypeError, obj.setObjectName, None) + + def testDefault(self): + #QObject.objectName() default + obj = QObject() + self.assertEqual('', obj.objectName()) + + def testUnicode(self): + #QObject.setObjectName(unicode) + name = u'diseƱo' + #FIXME Strange error on upstream when using equal(name, obj) + obj = QObject() + obj.setObjectName(name) + self.assertEqual(obj.objectName(), name) + + +if __name__ == '__main__': + unittest.main() |