diff options
Diffstat (limited to 'tests/auto/qml/qqmlqt/data')
28 files changed, 327 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlqt/data/atob.qml b/tests/auto/qml/qqmlqt/data/atob.qml new file mode 100644 index 0000000000..0d684003a1 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/atob.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + property string test1: Qt.atob() + property string test2: Qt.atob("SGVsbG8gd29ybGQh") +} + diff --git a/tests/auto/qml/qqmlqt/data/btoa.qml b/tests/auto/qml/qqmlqt/data/btoa.qml new file mode 100644 index 0000000000..0ecd01d284 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/btoa.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property string test1: Qt.btoa() + property string test2: Qt.btoa("Hello world!") +} diff --git a/tests/auto/qml/qqmlqt/data/createComponent.qml b/tests/auto/qml/qqmlqt/data/createComponent.qml new file mode 100644 index 0000000000..3ebc9f14f8 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/createComponent.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +QtObject { + property bool emptyArg: false + + property string relativeUrl + property string absoluteUrl + + property QtObject incorectArgCount1: Qt.createComponent() + property QtObject incorectArgCount2: Qt.createComponent("main.qml", 10) + + Component.onCompleted: { + emptyArg = (Qt.createComponent("") == null); + var r = Qt.createComponent("createComponentData.qml"); + relativeUrl = r.url; + + var a = Qt.createComponent("http://www.example.com/test.qml"); + absoluteUrl = a.url; + } +} diff --git a/tests/auto/qml/qqmlqt/data/createComponentData.qml b/tests/auto/qml/qqmlqt/data/createComponentData.qml new file mode 100644 index 0000000000..2a824e5362 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/createComponentData.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int test: 1913 +} diff --git a/tests/auto/qml/qqmlqt/data/createComponent_lib.js b/tests/auto/qml/qqmlqt/data/createComponent_lib.js new file mode 100644 index 0000000000..30499e943e --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/createComponent_lib.js @@ -0,0 +1,11 @@ +.pragma library + +function loadComponent() { + var component = Qt.createComponent("createComponentData.qml"); + return component.status; +} + +function createComponent() { + var component = Qt.createComponent("createComponentData.qml"); + return component.createObject(null); +} diff --git a/tests/auto/qml/qqmlqt/data/createComponent_lib.qml b/tests/auto/qml/qqmlqt/data/createComponent_lib.qml new file mode 100644 index 0000000000..a52453e8fa --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/createComponent_lib.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import "createComponent_lib.js" as Test + +Item { + property int status: Component.Null + property int readValue: 0 + + Component.onCompleted: { + status = Test.loadComponent() + readValue = Test.createComponent().test; + } +} diff --git a/tests/auto/qml/qqmlqt/data/createQmlObject.qml b/tests/auto/qml/qqmlqt/data/createQmlObject.qml new file mode 100644 index 0000000000..87601b1cc8 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/createQmlObject.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 + +Item { + id: root + + // errors resulting in exceptions + property QtObject incorrectArgCount1: Qt.createQmlObject() + property QtObject incorrectArgCount2: Qt.createQmlObject("import QtQuick 2.0\nQtObject{}", root, "main.qml", 10) + property QtObject noParent: Qt.createQmlObject("import QtQuick 2.0\nQtObject{\nproperty int test: 13}", 0) + property QtObject notAvailable: Qt.createQmlObject("import QtQuick 2.0\nQtObject{Blah{}}", root) + property QtObject errors: Qt.createQmlObject("import QtQuick 2.0\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") + + property bool emptyArg: false + + property bool success: false + + Component.onCompleted: { + // errors resulting in nulls + emptyArg = (Qt.createQmlObject("", root) == null); + try { + Qt.createQmlObject("import QtQuick 2.0\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) + } catch (error) { + console.log("RunTimeError: ",error.message); + } + + var o = Qt.createQmlObject("import QtQuick 2.0\nQtObject{\nproperty int test: 13\n}", root); + success = (o.test == 13); + + Qt.createQmlObject("import QtQuick 2.0\nItem {}\n", root); + } +} diff --git a/tests/auto/qml/qqmlqt/data/darker.qml b/tests/auto/qml/qqmlqt/data/darker.qml new file mode 100644 index 0000000000..ce6c705fb4 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/darker.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) + property variant test2: Qt.darker() + property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8) + property variant test4: Qt.darker("red"); + property variant test5: Qt.darker("perfectred"); // Non-existant color + property variant test6: Qt.darker(10); + property variant test7: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8, 10) +} + diff --git a/tests/auto/qml/qqmlqt/data/dateTimeConversion.qml b/tests/auto/qml/qqmlqt/data/dateTimeConversion.qml new file mode 100644 index 0000000000..641ba6e1ca --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/dateTimeConversion.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + // months are 0-based - so January = 0, December = 11. + property variant qtime: new Date(2000,0,0,14,15,38,200) // yyyy/MM/dd 14:15:38.200 + property variant qdate: new Date(2008,11,24) // 2008/12/24 hh:mm:ss.zzz + property variant qdatetime: new Date(2008,11,24,14,15,38,200) // 2008/12/24 14:15:38.200 + + property variant qdatetime2: new Date(2852,11,31,23,59,59,500) // 2852/12/31 23:59:59.500 + property variant qdatetime3: new Date(2000,0,1,0,0,0,0) // 2000/01/01 00:00:00.000 + property variant qdatetime4: new Date(2001,1,2) // 2001/02/02 hh:mm:ss.zzz + property variant qdatetime5: new Date(1999,0,1,2,3,4) // 1999/01/01 02:03:04.zzz + property variant qdatetime6: new Date(2008,1,24,14,15,38,200) // 2008/02/24 14:15:38.200 +} diff --git a/tests/auto/qml/qqmlqt/data/enums.qml b/tests/auto/qml/qqmlqt/data/enums.qml new file mode 100644 index 0000000000..5a2ff534af --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/enums.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property int test1: Qt.Key_Escape + property int test2: Qt.DescendingOrder + property int test3: Qt.ElideMiddle + property int test4: Qt.AlignRight +} + diff --git a/tests/auto/qml/qqmlqt/data/fontFamilies.qml b/tests/auto/qml/qqmlqt/data/fontFamilies.qml new file mode 100644 index 0000000000..70245ab159 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/fontFamilies.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.fontFamilies(10) + property variant test2: Qt.fontFamilies(); +} diff --git a/tests/auto/qml/qqmlqt/data/formatting.qml b/tests/auto/qml/qqmlqt/data/formatting.qml new file mode 100644 index 0000000000..7a462c8eeb --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/formatting.qml @@ -0,0 +1,44 @@ +import QtQuick 2.0 + +QtObject { + property date dateFromString: "2008-12-24" + property variant jsdate: new Date(2008,11,24,14,15,38,200) // months are 0-based + + function formatDate(prop) { + var v = eval(prop) + return [ + Qt.formatDate(v), + Qt.formatDate(v, Qt.DefaultLocaleLongDate), + Qt.formatDate(v, "ddd MMMM d yy") + ] + } + + 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 err_date1: Qt.formatDate() + property string err_date2: Qt.formatDate(new Date, new Object) + + property string err_time1: Qt.formatTime() + property string err_time2: Qt.formatTime(new Date, new Object) + + property string err_dateTime1: Qt.formatDateTime() + property string err_dateTime2: Qt.formatDateTime(new Date, new Object) +} diff --git a/tests/auto/qml/qqmlqt/data/hsla.qml b/tests/auto/qml/qqmlqt/data/hsla.qml new file mode 100644 index 0000000000..ff9622b339 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/hsla.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 + +QtObject { + property color test1: Qt.hsla(1, 0, 0, 0.8); + property color test2: Qt.hsla(1, 0.5, 0.3); + property color test3: Qt.hsla(1, 1); + property color test4: Qt.hsla(1, 1, 1, 1, 1); + property color test5: Qt.hsla(1.2, 1.3, 1.4, 1.5); + property color test6: Qt.hsla(-0.1, -0.2, -0.3, -0.4); +} + diff --git a/tests/auto/qml/qqmlqt/data/isQtObject.qml b/tests/auto/qml/qqmlqt/data/isQtObject.qml new file mode 100644 index 0000000000..6829209518 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/isQtObject.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + id: root + + property QtObject nullObject + + property bool test1: Qt.isQtObject(root) + property bool test2: Qt.isQtObject(nullObject) + property bool test3: Qt.isQtObject(10) + property bool test4: Qt.isQtObject(null) + property bool test5: Qt.isQtObject({ a: 10, b: 11 }) +} + diff --git a/tests/auto/qml/qqmlqt/data/lighter.qml b/tests/auto/qml/qqmlqt/data/lighter.qml new file mode 100644 index 0000000000..7db5e1edeb --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/lighter.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) + property variant test2: Qt.lighter() + property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8) + property variant test4: Qt.lighter("red"); + property variant test5: Qt.lighter("perfectred"); // Non-existant color + property variant test6: Qt.lighter(10); + property variant test7: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8, 5) +} diff --git a/tests/auto/qml/qqmlqt/data/md5.qml b/tests/auto/qml/qqmlqt/data/md5.qml new file mode 100644 index 0000000000..bec1ed1fe7 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/md5.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + property string test1: Qt.md5() + property string test2: Qt.md5("Hello World") +} diff --git a/tests/auto/qml/qqmlqt/data/openUrlExternally.qml b/tests/auto/qml/qqmlqt/data/openUrlExternally.qml new file mode 100644 index 0000000000..37b9f513d9 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/openUrlExternally.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + Component.onCompleted: Qt.openUrlExternally("test:url") + + property bool testFile + onTestFileChanged: Qt.openUrlExternally("test.html") +} diff --git a/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js new file mode 100644 index 0000000000..702357afbf --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js @@ -0,0 +1,9 @@ +.pragma library + +function loadTest() { + Qt.openUrlExternally("test:url") +} + +function loadFile() { + Qt.openUrlExternally("test.html") +} diff --git a/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml new file mode 100644 index 0000000000..4bf584d134 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 +import "openUrlExternally_lib.js" as Test + +Item { + Component.onCompleted: Test.loadTest(); + + property bool testFile + onTestFileChanged: Test.loadFile(); +} diff --git a/tests/auto/qml/qqmlqt/data/point.qml b/tests/auto/qml/qqmlqt/data/point.qml new file mode 100644 index 0000000000..fe12ee6232 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/point.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.point(19, 34); + property variant test2: Qt.point(-3, 109.2); + property variant test3: Qt.point(-3); + property variant test4: Qt.point(-3, 109.2, 1); +} + diff --git a/tests/auto/qml/qqmlqt/data/quit.qml b/tests/auto/qml/qqmlqt/data/quit.qml new file mode 100644 index 0000000000..e3b91660e7 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/quit.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + Component.onCompleted: Qt.quit() +} diff --git a/tests/auto/qml/qqmlqt/data/rect.qml b/tests/auto/qml/qqmlqt/data/rect.qml new file mode 100644 index 0000000000..b294b22c5b --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/rect.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.rect(10, 13, 100, 109) + property variant test2: Qt.rect(-10, 13, 100, 109.6) + property variant test3: Qt.rect(10, 13); + property variant test4: Qt.rect(10, 13, 100, 109, 10) + property variant test5: Qt.rect(10, 13, 100, -109) +} diff --git a/tests/auto/qml/qqmlqt/data/resolvedUrl.qml b/tests/auto/qml/qqmlqt/data/resolvedUrl.qml new file mode 100644 index 0000000000..06ef48b82b --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/resolvedUrl.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +QtObject { + property string result + property bool isString: false + + Component.onCompleted: { + var a = Qt.resolvedUrl("resolvedUrl.qml"); + result = a; + isString = (typeof a) == "string" + } +} + diff --git a/tests/auto/qml/qqmlqt/data/rgba.qml b/tests/auto/qml/qqmlqt/data/rgba.qml new file mode 100644 index 0000000000..3b010f68cb --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/rgba.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 + +QtObject { + property color test1: Qt.rgba(1, 0, 0, 0.8); + property color test2: Qt.rgba(1, 0.5, 0.3); + property color test3: Qt.rgba(1, 1); + property color test4: Qt.rgba(1, 1, 1, 1, 1); + property color test5: Qt.rgba(1.2, 1.3, 1.4, 1.5); + property color test6: Qt.rgba(-0.1, -0.2, -0.3, -0.4); +} diff --git a/tests/auto/qml/qqmlqt/data/size.qml b/tests/auto/qml/qqmlqt/data/size.qml new file mode 100644 index 0000000000..41051f4216 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/size.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.size(19, 34); + property variant test2: Qt.size(3, 109.2); + property variant test3: Qt.size(-3, 10); + property variant test4: Qt.size(3); + property variant test5: Qt.size(3, 109.2, 1); +} + + diff --git a/tests/auto/qml/qqmlqt/data/tint.qml b/tests/auto/qml/qqmlqt/data/tint.qml new file mode 100644 index 0000000000..816e6e9b08 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/tint.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property color test1: Qt.tint("red", "blue"); + property color test2: Qt.tint(Qt.rgba(1, 0, 0), Qt.rgba(0, 0, 0, 0)); + property color test3: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5)); + property color test4: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5), 10); + property color test5: Qt.tint("red") +} diff --git a/tests/auto/qml/qqmlqt/data/vector.qml b/tests/auto/qml/qqmlqt/data/vector.qml new file mode 100644 index 0000000000..5a949515ed --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/vector.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.vector3d(1, 0, 0.9); + property variant test2: Qt.vector3d(102, -10, -982.1); + property variant test3: Qt.vector3d(102, -10); + property variant test4: Qt.vector3d(102, -10, -982.1, 10); +} diff --git a/tests/auto/qml/qqmlqt/data/vector4.qml b/tests/auto/qml/qqmlqt/data/vector4.qml new file mode 100644 index 0000000000..554dd1e9d4 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/vector4.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.vector4d(1, 0, 0.9, 0.6); + property variant test2: Qt.vector4d(102, -10, -982.1, 10); + property variant test3: Qt.vector4d(102, -10, -982.1); + property variant test4: Qt.vector4d(102, -10, -982.1, 10, 15); +} |