add new QDatetime init function with 6 arguments

Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
linjunhalida 2011-01-04 23:43:56 +08:00 committed by Hugo Parente Lima
commit 32681f7b70
2 changed files with 18 additions and 0 deletions

View file

@ -822,6 +822,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="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">

View file

@ -44,7 +44,18 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(dateTime, other.toPython())
# with 6 arguments
other = QDateTime(2010, 04, 23, 11, 14, 01)
otherDate = other.date()
self.assertEqual(2010, otherDate.year())
self.assertEqual(4, otherDate.month())
self.assertEqual(23, otherDate.day())
otherTime = other.time()
self.assertEqual(11, otherTime.hour())
self.assertEqual(14, otherTime.minute())
self.assertEqual(1, otherTime.second())
if __name__ == '__main__':
unittest.main()