aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-06-15 20:26:24 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-06-15 20:34:02 -0300
commit0eb8d670c240b5ea621dba6271139f30cc97790a (patch)
tree312c89435590558ea08f75fc909764b5cd2cfacb /tests
parent13b61ca7e55f52b501de9e028d2d7048836979ba (diff)
Added QVariant::Type as a primitive type.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/QtSql/CMakeLists.txt1
-rw-r--r--tests/QtSql/qvarianttype_test.py36
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/QtSql/CMakeLists.txt b/tests/QtSql/CMakeLists.txt
index a9446910..25fba44a 100644
--- a/tests/QtSql/CMakeLists.txt
+++ b/tests/QtSql/CMakeLists.txt
@@ -1 +1,2 @@
PYSIDE_TEST(qsqldatabaseandqueries_test.py)
+PYSIDE_TEST(qvarianttype_test.py)
diff --git a/tests/QtSql/qvarianttype_test.py b/tests/QtSql/qvarianttype_test.py
new file mode 100644
index 00000000..7eae67fd
--- /dev/null
+++ b/tests/QtSql/qvarianttype_test.py
@@ -0,0 +1,36 @@
+'''Test cases for QVariant::Type converter'''
+import unittest
+from PySide.QtCore import *
+from PySide.QtSql import *
+
+class QVariantTypeTest(unittest.TestCase):
+ def testQVariantType(self):
+ f = QSqlField("name", unicode)
+ self.assertEqual(f.type(), unicode)
+
+ f = QSqlField("name", str)
+ self.assertEqual(f.type(), unicode)
+
+ f = QSqlField("name", "QString")
+ self.assertEqual(f.type(), unicode)
+
+ f = QSqlField("name", "double")
+ self.assertEqual(f.type(), float)
+
+ f = QSqlField("name", float)
+ self.assertEqual(f.type(), float)
+
+ f = QSqlField("name", int)
+ self.assertEqual(f.type(), int)
+
+ f = QSqlField("name", long)
+ self.assertEqual(f.type(), int) # long isn't registered in QVariant:Type, just in QMetaType::Type
+
+ #f = QSqlField("name", QObject)
+ #self.assertEqual(f.type(), None)
+
+ f = QSqlField("name", None)
+ self.assertEqual(f.type(), None)
+
+if __name__ == '__main__':
+ unittest.main()