diff options
author | Juhapekka Piiroinen <juhapekka.piiroinen@gmail.com> | 2012-03-05 07:59:41 +0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.lima@openbossa.org> | 2012-03-13 18:43:04 +0100 |
commit | f011ce2cb9e2b93a748874de007232ec88cc8ac1 (patch) | |
tree | 08cb7741f9d1e3691041583dd907573a33116072 | |
parent | fe8dc36f90fe64590f7f13843a076f8d2d61f378 (diff) |
Bug fix for PYSIDE-7
This should resolve the issue in PYSIDE-7 "QDateTime does not support the 6-argument format".
Added function signature for 6-argument version and a testcase.
Change-Id: I617eefab6a41939c37e2f1bf800857bc2d74b6ee
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
-rw-r--r-- | PySide/QtCore/typesystem_core_common.xml | 7 | ||||
-rw-r--r-- | tests/QtCore/python_conversion.py | 17 |
2 files changed, 24 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml index 8955612a3..2e8313122 100644 --- a/PySide/QtCore/typesystem_core_common.xml +++ b/PySide/QtCore/typesystem_core_common.xml @@ -1257,6 +1257,13 @@ %0 = new %TYPE(date, time, Qt::TimeSpec(%8)); </inject-code> </add-function> + <add-function signature="QDateTime(int, int, int, int, int, int)"> + <inject-code class="target" position="beginning"> + QDate date(%1, %2, %3); + QTime time(%4, %5, %6); + %0 = new %TYPE(date, time); + </inject-code> + </add-function> <add-function signature="__repr__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="repr_code"> diff --git a/tests/QtCore/python_conversion.py b/tests/QtCore/python_conversion.py index 2472deed0..84845c0a8 100644 --- a/tests/QtCore/python_conversion.py +++ b/tests/QtCore/python_conversion.py @@ -43,5 +43,22 @@ class TestDateTimeConversions (unittest.TestCase): self.assertEqual(dateTime, other.toPython()) + def testQDateTime6arg(self): + dateTime = datetime.datetime(2010, 4, 23, 11, 14, 7) + other = QDateTime(dateTime) + + otherDate = other.date() + self.assertEqual(dateTime.year, otherDate.year()) + self.assertEqual(dateTime.month, otherDate.month()) + self.assertEqual(dateTime.day, otherDate.day()) + + otherTime = other.time() + self.assertEqual(dateTime.hour, otherTime.hour()) + self.assertEqual(dateTime.minute, otherTime.minute()) + self.assertEqual(dateTime.second, otherTime.second()) + self.assertEqual(dateTime.microsecond/1000, otherTime.msec()) + + self.assertEqual(dateTime, other.toPython()) + if __name__ == '__main__': unittest.main() |