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>
This commit is contained in:
parent
fe8dc36f90
commit
f011ce2cb9
2 changed files with 24 additions and 0 deletions
|
|
@ -1257,6 +1257,13 @@
|
||||||
%0 = new %TYPE(date, time, Qt::TimeSpec(%8));
|
%0 = new %TYPE(date, time, Qt::TimeSpec(%8));
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</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*">
|
<add-function signature="__repr__" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
<insert-template name="repr_code">
|
<insert-template name="repr_code">
|
||||||
|
|
|
||||||
|
|
@ -43,5 +43,22 @@ class TestDateTimeConversions (unittest.TestCase):
|
||||||
|
|
||||||
self.assertEqual(dateTime, other.toPython())
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue