diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-29 22:08:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-29 22:08:18 (GMT) |
commit | afa73122a2a6394ee1a6b9d43c0b71e2bd7c1320 (patch) | |
tree | 591d17a66d7d41a5ea25a666e30b7a58145c1cf2 /tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml | |
parent | 8bf770a1c9c28781aa8bfdea13df5194fac13573 (diff) | |
parent | 502f3b5f38f80d0eb7be1516a22cd051fb03873d (diff) | |
download | Qt-afa73122a2a6394ee1a6b9d43c0b71e2bd7c1320.zip Qt-afa73122a2a6394ee1a6b9d43c0b71e2bd7c1320.tar.gz Qt-afa73122a2a6394ee1a6b9d43c0b71e2bd7c1320.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (151 commits)
expect fail for some PinchArea tests on mac
Allow functions to be passed in as values for grouped properties
Fix lineHeight autotests.
Update Docs, Examples and Demos for new CreateObject overloadable
Adding support for group properties in Component::CreateObject()
Update test, versioning is fixed so expect-fail no longer needed
Test failure fixed - remove XFAIL
photoviewer needs QtQuick 1.1 for Image::cache
disable some pincharea tests on mac temporarily
Fix failing test on mac for Qt.application
Fix test breakage for qdeclarativeworkerscript
Fix typo in error message.
Doc fix for lineHeight.
Add support for line spacing in Text element.
Fixing right-to-left text in Text and TextInput
Fix MaximumLineCount in Text and add tests
Ensure simple objects also get the appropriate property cache
Add test for Loader implicitWidth/implicitHeight
Don't crash when appending a null item
Test for passing functions to createObject() for property bindings
...
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml index 948b39c..c8c926a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml @@ -1,13 +1,73 @@ import Qt.test 1.0 +import QtQuick 1.0 + +import "functionAssignment.js" as Script MyQmlObject { property variant a - property bool runTest: false - onRunTestChanged: { + property int aNumber: 10 + + property bool assignToProperty: false + property bool assignToPropertyFromJsFile: false + + property bool assignWithThis: false + property bool assignWithThisFromJsFile: false + + property bool assignToValueType: false + + property bool assignFuncWithoutReturn: false + property bool assignWrongType: false + property bool assignWrongTypeToValueType: false + + + onAssignToPropertyChanged: { + function myFunction() { + return aNumber * 10; + } + a = myFunction; + } + + property QtObject obj: QtObject { + property int aNumber: 4212 + function myFunction() { + return this.aNumber * 10; // should use the aNumber from root, not this object + } + } + onAssignWithThisChanged: { + a = obj.myFunction; + } + + onAssignToPropertyFromJsFileChanged: { + Script.bindPropertyWithThis() + } + + onAssignWithThisFromJsFileChanged: { + Script.bindProperty() + } + + property Text text: Text { } + onAssignToValueTypeChanged: { + text.font.pixelSize = (function() { return aNumber * 10; }) + a = (function() { return text.font.pixelSize; }) + } + + + // detecting errors: + + onAssignFuncWithoutReturnChanged: { function myFunction() { - console.log("hello world"); } a = myFunction; } + onAssignWrongTypeChanged: { + function myFunction() { + return 'a string'; + } + aNumber = myFunction; + } + + onAssignWrongTypeToValueTypeChanged: { + text.font.pixelSize = (function() { return 'a string'; }) + } } |