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:
parent
15dd2e07ed
commit
32681f7b70
2 changed files with 18 additions and 0 deletions
|
|
@ -822,6 +822,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="__reduce__" return-type="PyObject*">
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
<insert-template name="reduce_code">
|
<insert-template name="reduce_code">
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,18 @@ class TestDateTimeConversions (unittest.TestCase):
|
||||||
|
|
||||||
self.assertEqual(dateTime, other.toPython())
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue