Use V4 binding for non-final properties where possible
[profile/ivi/qtdeclarative.git] / tests / auto / qml / qqmlecmascript / data / exportDate.8.qml
1 import Qt.test 1.0
2 import QtQuick 2.0
3
4 MyTypeObject {
5     boolProperty: false
6
7     Component.onCompleted: {
8         var dt = datetimeExporter.getDateTime()
9         var offset = datetimeExporter.getDateTimeOffset()
10         var date = datetimeExporter.getDate()
11         var timespec = datetimeExporter.getTimeSpec()
12
13         // The test date is 2009-5-12 23:59:59 (UTC-11:30)
14         var compare = new Date('2009-05-12T23:59:59-11:30')
15
16         // Adjust for timezone to extract correct partial values
17         var dtUtc = new Date(dt.getTime() + (offset * 60000))
18         var dtAdjusted = new Date(dtUtc.getUTCFullYear(),
19                                   dtUtc.getUTCMonth(),
20                                   dtUtc.getUTCDate(),
21                                   dtUtc.getUTCHours(),
22                                   dtUtc.getUTCMinutes(),
23                                   dtUtc.getUTCSeconds(),
24                                   dtUtc.getUTCMilliseconds())
25
26         boolProperty = (dt.getTime() == compare.getTime()) &&
27                        (offset == -((11 * 60) + 30)) &&
28                        (timespec == '-11:30') &&
29                        (dtAdjusted.getFullYear() == 2009) &&
30                        (dtAdjusted.getMonth() == 5-1) &&
31                        (dtAdjusted.getDate() == 12) &&
32                        (dtAdjusted.getHours() == 23) &&
33                        (dtAdjusted.getMinutes() == 59) &&
34                        (dtAdjusted.getSeconds() == 59) &&
35                        (date.getFullYear() == 2009) &&
36                        (date.getMonth() == 5-1) &&
37                        (date.getDate() == 12)
38     }
39 }