summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt/data/formatting.qml')
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/formatting.qml53
1 files changed, 34 insertions, 19 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
index 35c6a29..f520aeb 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
@@ -1,29 +1,44 @@
import QtQuick 1.0
QtObject {
- property date date1: "2008-12-24"
- property string test1: Qt.formatDate(date1)
- property string test2: Qt.formatDate(date1, Qt.DefaultLocaleLongDate)
- property string test3: Qt.formatDate(date1, "ddd MMMM d yy")
+ property date dateFromString: "2008-12-24"
+ property variant jsdate: new Date(2008,11,24,14,15,38,200) // months are 0-based
- property variant time1: new Date(0,0,0,14,15,38,200)
- property string test4: Qt.formatTime(time1)
- property string test5: Qt.formatTime(time1, Qt.DefaultLocaleLongDate)
- property string test6: Qt.formatTime(time1, "H:m:s a")
- property string test7: Qt.formatTime(time1, "hh:mm:ss.zzz")
+ function formatDate(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatDate(v),
+ Qt.formatDate(v, Qt.DefaultLocaleLongDate),
+ Qt.formatDate(v, "ddd MMMM d yy")
+ ]
+ }
- property variant dateTime1: new Date(1978,2,4,9,13,54)
- property string test8: Qt.formatDateTime(dateTime1)
- property string test9: Qt.formatDateTime(dateTime1, Qt.DefaultLocaleLongDate)
- property string test10: Qt.formatDateTime(dateTime1, "M/d/yy H:m:s a")
+ function formatTime(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatTime(v),
+ Qt.formatTime(v, Qt.DefaultLocaleLongDate),
+ Qt.formatTime(v, "H:m:s a"),
+ Qt.formatTime(v, "hh:mm:ss.zzz")
+ ]
+ }
+
+ function formatDateTime(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatDateTime(v),
+ Qt.formatDateTime(v, Qt.DefaultLocaleLongDate),
+ Qt.formatDateTime(v, "M/d/yy H:m:s a")
+ ]
+ }
// Error cases
- property string test11: Qt.formatDate()
- property string test12: Qt.formatDate(new Date, new Object)
+ property string err_date1: Qt.formatDate()
+ property string err_date2: Qt.formatDate(new Date, new Object)
- property string test13: Qt.formatTime()
- property string test14: Qt.formatTime(new Date, new Object)
+ property string err_time1: Qt.formatTime()
+ property string err_time2: Qt.formatTime(new Date, new Object)
- property string test15: Qt.formatDateTime()
- property string test16: Qt.formatDateTime(new Date, new Object)
+ property string err_dateTime1: Qt.formatDateTime()
+ property string err_dateTime2: Qt.formatDateTime(new Date, new Object)
}