summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-04 14:08:21 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-04 14:08:21 (GMT)
commit48edd0b663b29413452389c906487cc9b0408b29 (patch)
tree0b5e3e9de4c45adec46a80845ed640ee16ba46b1 /tests
parent8bc0456491e5a7e1fc677fce6e76932ab0d923e8 (diff)
parent6f09fc3a475eb2e1c843f4aebe7ea0d15182ac1d (diff)
downloadQt-48edd0b663b29413452389c906487cc9b0408b29.zip
Qt-48edd0b663b29413452389c906487cc9b0408b29.tar.gz
Qt-48edd0b663b29413452389c906487cc9b0408b29.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: (100 commits) Update QML PropertyAnimation::easing docs Add testcase for QTBUG-7730 Add autotests for tab and backtab in Keys and KeyNavigation. Run signal expressions on attached property objects in correct scope Fixup test Add support for tab and backtab in KeyNavigation Mark QGraphicsItem position properties as FINAL Move the multimedia files to the correct place. Fix grammar stringifying "on" as "readonly" Improve grouped property error messages Don't mess with highlight size if highlightFollowsCurrentItem is false. Fix ListView contentHeight calculation. Remove Qt.playSound() Add formatting functions to QML's global Qt object. Signal handler requires exactly one value. QDeclarativeContext::contextProperty() should also access ids Compile without QVariant::EasingCurve in Qt 4.6.2. Documented view behavior when items are removed from start of view. Fix tests failing due to javascript eval errors. Remove unnecessary additional hash of QDeclarativeGridViewAttached ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/declarative.pro3
-rw-r--r--tests/auto/declarative/examples/tst_examples.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/properties.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/properties2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/properties3.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/properties4.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/properties5.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/binding.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/color.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/empty.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/loop.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/parent.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/simple.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro8
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp (renamed from tests/auto/declarative/qdeclarativewebview/testtypes.h)37
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp20
-rw-r--r--tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp72
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp74
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/gridview.qml6
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml69
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp183
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/keys.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp38
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml8
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h12
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp35
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml71
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp168
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeparticles/data/particles.qml2
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/displaypath.qml2
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/pathview.qml2
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/pathview2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/pathview3.qml4
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml115
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp167
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/TestType.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp37
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/formatting.qml19
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp36
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/basic.qml1
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/elements.qml1
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/forward.pngbin0 -> 2377 bytes
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/javaScript.qml1
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/loadError.qml1
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/newwindows.qml1
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml3
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/sethtml.qml1
-rw-r--r--tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro3
-rw-r--r--tests/auto/declarative/qdeclarativewebview/testtypes.cpp52
-rw-r--r--tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp347
-rw-r--r--tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js6
-rw-r--r--tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro9
-rw-r--r--tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp193
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/script.js5
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml24
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro9
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp194
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp6
-rwxr-xr-xtests/auto/declarative/runall.sh81
-rw-r--r--tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml1
-rw-r--r--tests/auto/declarative/visual/webview/embedding/nesting.qml1
-rw-r--r--tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml1
-rw-r--r--tests/auto/declarative/visual/webview/javascript/windowObjects.qml1
-rw-r--r--tests/auto/declarative/visual/webview/settings/fontFamily.qml1
-rw-r--r--tests/auto/declarative/visual/webview/settings/fontSize.qml1
-rw-r--r--tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml1
-rw-r--r--tests/auto/declarative/visual/webview/settings/setFontFamily.qml1
-rw-r--r--tests/auto/declarative/visual/webview/zooming/pageWidth.qml1
-rw-r--r--tests/auto/declarative/visual/webview/zooming/renderControl.qml1
-rw-r--r--tests/auto/declarative/visual/webview/zooming/resolution.qml1
-rw-r--r--tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml1
-rw-r--r--tests/auto/declarative/visual/webview/zooming/zooming.qml1
-rw-r--r--tests/auto/headers/tst_headers.cpp1
-rw-r--r--tests/benchmarks/declarative/binding/binding.pro3
-rw-r--r--tests/benchmarks/declarative/binding/data/idproperty.txt2
-rw-r--r--tests/benchmarks/declarative/binding/data/objectproperty.txt2
-rw-r--r--tests/benchmarks/declarative/binding/testtypes.h6
-rw-r--r--tests/benchmarks/declarative/binding/tst_binding.cpp16
-rw-r--r--tests/benchmarks/declarative/creation/tst_creation.cpp5
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml2
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml6
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro3
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h6
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp14
-rw-r--r--tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro2
-rw-r--r--tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp8
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp11
169 files changed, 2100 insertions, 473 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 42ff523..99a32d9 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -7,6 +7,7 @@ SUBDIRS += \
qdeclarativeanimations \ # Cover
qdeclarativebehaviors \ # Cover
qdeclarativebinding \ # Cover
+ qdeclarativecomponent \ # Cover
qdeclarativeconnection \ # Cover
qdeclarativecontext \ # Cover
qdeclarativedatetimeformatter \ # Cover
@@ -55,6 +56,8 @@ SUBDIRS += \
qdeclarativexmllistmodel \ # Cover
qpacketprotocol \ # Cover
qdeclarativerepeater \ # Cover
+ qdeclarativeworkerscript \ # Cover
+ qdeclarativeworkerlistmodel \ # Cover
qdeclarativevaluetypes \ # Cover
qdeclarativexmlhttprequest \ # Cover
qdeclarativeimageprovider \ # Cover
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp
index 6160e7c..106a4e0 100644
--- a/tests/auto/declarative/examples/tst_examples.cpp
+++ b/tests/auto/declarative/examples/tst_examples.cpp
@@ -190,7 +190,6 @@ void tst_examples::examples()
<< "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure"
<< file;
QProcess p;
-qDebug() << qmlruntime << arguments;
p.start(qmlruntime, arguments);
QVERIFY(p.waitForFinished());
QCOMPARE(p.exitStatus(), QProcess::NormalExit);
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml
index 6381df3..2629cf4 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml
@@ -7,6 +7,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: PropertyAnimation { from: "blue"; to: "green"; }
+ PropertyAnimation on x { from: "blue"; to: "green"; }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml
index 8d57e41..1543a2a 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml
@@ -7,6 +7,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { from: "blue"; to: "green"; }
+ NumberAnimation on x { from: "blue"; to: "green"; }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml
index c4867c3..aa98c33 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml
@@ -5,7 +5,7 @@ Rectangle {
height: 320
Rectangle {
color: "red"
- color: ColorAnimation { from: 10; to: 15; }
+ ColorAnimation on color { from: 10; to: 15; }
width: 50; height: 50
x: 100; y: 100
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
index d9660b6..3f00e68 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
@@ -9,7 +9,7 @@ Rectangle {
id: redRect
width: 100; height: 100
color: Qt.rgba(1,0,0)
- x: Behavior {
+ Behavior on x {
NumberAnimation { objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml
index 36417db..efed058 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml
@@ -9,7 +9,7 @@ Rectangle {
id: redRect
width: 100; height: 100
color: Qt.rgba(1,0,0)
- x: SequentialAnimation {
+ SequentialAnimation on x {
running: false
NumberAnimation { objectName: "MyAnim"; running: true }
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml
index 7e73f57..4437815 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/properties.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { to: 200 }
+ NumberAnimation on x { to: 200 }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml
index 6c96155..b1f2020 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { targets: theRect; properties: "x"; to: 200; }
+ NumberAnimation on x { targets: theRect; properties: "x"; to: 200; }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml
index ff08885..0a0ed6f 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { target: theRect; property: "x"; to: 300; }
+ NumberAnimation on x { target: theRect; property: "x"; to: 300; }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml
index dab7e5f..a90f004 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { target: theRect; property: "y"; to: 200; }
+ NumberAnimation on x { target: theRect; property: "y"; to: 200; }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml
index 38396b1..7d3cec9 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { targets: theRect; properties: "y"; to: 200; }
+ NumberAnimation on x { targets: theRect; properties: "y"; to: 200; }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml
index c35063d..2260440 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { id: anim; objectName: "MyAnim"; to: 200 }
+ NumberAnimation on x { id: anim; objectName: "MyAnim"; to: 200 }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml
index 1a60542..36d6c72 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml
@@ -9,6 +9,6 @@ Rectangle {
color: "red"
width: 50; height: 50
x: 100; y: 100
- x: NumberAnimation { id: anim; objectName: "MyAnim"; running: false; to: 200 }
+ NumberAnimation on x { id: anim; objectName: "MyAnim"; running: false; to: 200 }
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 53c63b5..f5e15fb 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -217,21 +217,21 @@ void tst_qdeclarativeanimations::resume()
animation.setProperty("x");
animation.setFrom(10);
animation.setTo(200);
- animation.setDuration(500);
+ animation.setDuration(1000);
QVERIFY(animation.from() == 10);
animation.start();
- QTest::qWait(100);
+ QTest::qWait(400);
animation.pause();
qreal x = rect.x();
- QVERIFY(x != qreal(200));
+ QVERIFY(x != qreal(200) && x != qreal(10));
QVERIFY(animation.isRunning());
QVERIFY(animation.isPaused());
animation.resume();
QVERIFY(animation.isRunning());
QVERIFY(!animation.isPaused());
- QTest::qWait(100);
+ QTest::qWait(400);
animation.stop();
QVERIFY(rect.x() > x);
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml
index 201da37..e982f21 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml
@@ -9,7 +9,7 @@ Rectangle {
objectName: "MyRect"
width: 100; height: 100; color: "green"
x: basex
- x: Behavior { NumberAnimation { duration: 500; } }
+ Behavior on x { NumberAnimation { duration: 500; } }
}
MouseArea {
id: clicker
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml
index 91dbbd1..f2f4742 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml
@@ -7,7 +7,7 @@ Rectangle {
objectName: "MyRect"
width: 100; height: 100;
color: "green"
- color: Behavior { ColorAnimation { duration: 500; } }
+ Behavior on color { ColorAnimation { duration: 500; } }
}
MouseArea {
id: clicker
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml
index 8d032f0..3ea9376 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml
@@ -6,6 +6,6 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior { NumberAnimation { duration: 500; } }
+ Behavior on x { NumberAnimation { duration: 500; } }
}
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml
index 3c7078a..1403eb9 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior {
+ Behavior on x {
objectName: "MyBehavior";
enabled: false
NumberAnimation { duration: 200; }
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml
index ba7cc9c..12b1b7b 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml
@@ -9,7 +9,7 @@ Rectangle {
id: redRect
width: 100; height: 100
color: Qt.rgba(1,0,0)
- x: Behavior {
+ Behavior on x {
NumberAnimation { objectName: "MyAnim"; running: true }
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml
index 95d934a..5e30f03 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior {}
+ Behavior on x {}
}
MouseArea {
id: clicker
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml
index 1b2025a..ca0ea54 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior {
+ Behavior on x {
objectName: "MyBehavior";
NumberAnimation { target: rect; property: "x"; duration: 500; }
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml
index 14883d4..a6c4ed9 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- pos: Behavior { PropertyAnimation { duration: 500; } }
+ Behavior on pos { PropertyAnimation { duration: 500; } }
}
MouseArea {
id: clicker
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml
index b43ddbc..2dda220 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- pos.x: Behavior { NumberAnimation { duration: 500; } }
+ Behavior on pos.x { NumberAnimation { duration: 500; } }
}
MouseArea {
id: clicker
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml
index 5f2c057..6187768 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior { NumberAnimation { duration: 200; } }
+ Behavior on x { NumberAnimation { duration: 200; } }
onXChanged: x = 100;
}
states: State {
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml
index f267a05..640a7d1 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior {
+ Behavior on x {
objectName: "MyBehavior";
NumberAnimation { targets: rect; properties: "y"; duration: 200; }
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml
index 7c7fdcb..3860ec7 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- parent: Behavior {
+ Behavior on parent {
SequentialAnimation {
PauseAnimation { duration: 500 }
PropertyAction {}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml
index ba744b1..6419a6b 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior {
+ Behavior on x {
objectName: "MyBehavior"
NumberAnimation { duration: 200 }
NumberAnimation { duration: 1000 }
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml
index a91ca88..b22441a 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml
@@ -11,6 +11,6 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior { NumberAnimation { duration: 500; } }
+ Behavior on x { NumberAnimation { duration: 500; } }
}
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml
index ac98ed0..c28fa9a 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml
@@ -6,7 +6,7 @@ Rectangle {
id: rect
objectName: "MyRect"
width: 100; height: 100; color: "green"
- x: Behavior {
+ Behavior on x {
objectName: "MyBehavior";
NumberAnimation { duration: 500; }
}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index f87330d..0bf0b81 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -260,7 +260,7 @@ void tst_qdeclarativebehaviors::reassignedAnimation()
{
QDeclarativeEngine engine;
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml"));
- QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:12) Cannot change the animation assigned to a Behavior.").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9) Cannot change the animation assigned to a Behavior.").toUtf8().constData());
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
QVERIFY(rect);
QCOMPARE(qobject_cast<QDeclarativeNumberAnimation*>(
diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
new file mode 100644
index 0000000..c7affb7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+QT += script network
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativecomponent.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativewebview/testtypes.h b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index 8eb703f..c9e304c 100644
--- a/tests/auto/declarative/qdeclarativewebview/testtypes.h
+++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -38,29 +38,38 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef TESTTYPES_H
-#define TESTTYPES_H
+#include <qtest.h>
-#include <private/qdeclarativewebview_p.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecomponent.h>
-class MyWebView : public QDeclarativeWebView
+class tst_qdeclarativecomponent : public QObject
{
Q_OBJECT
- Q_PROPERTY(int pixelsPainted READ pixelsPainted);
-
public:
- MyWebView() : pp(0) {}
-
- int pixelsPainted() const { return pp; }
+ tst_qdeclarativecomponent() { }
- void drawContents(QPainter *p, const QRect &r);
+private slots:
+ void loadEmptyUrl();
private:
- int pp;
+ QDeclarativeEngine engine;
};
-QML_DECLARE_TYPE(MyWebView);
+void tst_qdeclarativecomponent::loadEmptyUrl()
+{
+ QDeclarativeComponent c(&engine);
+ c.loadUrl(QUrl());
+
+ QVERIFY(c.isError());
+ QCOMPARE(c.errors().count(), 1);
+ QDeclarativeError error = c.errors().first();
+ QCOMPARE(error.url(), QUrl());
+ QCOMPARE(error.line(), -1);
+ QCOMPARE(error.column(), -1);
+ QCOMPARE(error.description(), QLatin1String("Invalid empty URL"));
+}
-void registerTypes();
+QTEST_MAIN(tst_qdeclarativecomponent)
-#endif // TESTTYPES_H
+#include "tst_qdeclarativecomponent.moc"
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index 5f03989..f0117f5 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -60,6 +60,7 @@ private slots:
void setContextProperty();
void addDefaultObject();
void destruction();
+ void idAsContextProperty();
private:
QDeclarativeEngine engine;
@@ -429,6 +430,25 @@ void tst_qdeclarativecontext::destruction()
QCOMPARE(ctxt, expr.context());
}
+void tst_qdeclarativecontext::idAsContextProperty()
+{
+ QDeclarativeComponent component(&engine);
+ component.setData("import Qt 4.6; QtObject { property var a; a: QtObject { id: myObject } }", QUrl());
+
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ QVariant a = obj->property("a");
+ QVERIFY(a.userType() == QMetaType::QObjectStar);
+
+ QVariant ctxt = qmlContext(obj)->contextProperty("myObject");
+ QVERIFY(ctxt.userType() == QMetaType::QObjectStar);
+
+ QVERIFY(a == ctxt);
+
+ delete obj;
+}
+
QTEST_MAIN(tst_qdeclarativecontext)
#include "tst_qdeclarativecontext.moc"
diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp
index 9543280..6cd0bdb 100644
--- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp
+++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp
@@ -274,7 +274,7 @@ void tst_qdeclarativedom::loadComposite()
void tst_qdeclarativedom::testValueSource()
{
QByteArray qml = "import Qt 4.6\n"
- "Rectangle { height: SpringFollow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}";
+ "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}";
QDeclarativeEngine freshEngine;
QDeclarativeDomDocument document;
@@ -306,7 +306,7 @@ void tst_qdeclarativedom::testValueSource()
void tst_qdeclarativedom::testValueInterceptor()
{
QByteArray qml = "import Qt 4.6\n"
- "Rectangle { height: Behavior { NumberAnimation { duration: 100 } } }";
+ "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }";
QDeclarativeEngine freshEngine;
QDeclarativeDomDocument document;
@@ -823,8 +823,8 @@ void tst_qdeclarativedom::copy()
" property int a: 10\n"
" x: 10\n"
" y: x + 10\n"
- " z: NumberAnimation {}\n"
- " opacity: Behavior {}\n"
+ " NumberAnimation on z {}\n"
+ " Behavior on opacity {}\n"
" Component {\n"
" Item{}\n"
" }\n"
@@ -1193,18 +1193,18 @@ void tst_qdeclarativedom::copy()
void tst_qdeclarativedom::position()
{
QByteArray qml = "import Qt 4.6\n"
- /*14*/ "Item {\n"
- /*21*/ " id: myItem\n"
- /*36*/ " property int a: 10\n"
- /*59*/ " x: 10\n"
- /*69*/ " y: x + 10\n"
- /*83*/ " z: NumberAnimation {}\n"
- /*109*/ " opacity: Behavior {}\n"
- /*134*/ " Component {\n"
- /*150*/ " Item{}\n"
- /*165*/ " }\n"
- /*171*/ " children: [ Item{}, Item{} ]\n"
- /*204*/ "}\n";
+ "Item {\n"
+ " id: myItem\n"
+ " property int a: 10\n"
+ " x: 10\n"
+ " y: x + 10\n"
+ " NumberAnimation on z {}\n"
+ " Behavior on opacity {}\n"
+ " Component {\n"
+ " Item{}\n"
+ " }\n"
+ " children: [ Item{}, Item{} ]\n"
+ "}\n";
QDeclarativeDomDocument document;
@@ -1227,19 +1227,19 @@ void tst_qdeclarativedom::position()
QCOMPARE(y.length(), 1);
QDeclarativeDomProperty z = root.property("z");
- QCOMPARE(z.position(), 87);
+ QCOMPARE(z.position(), 106);
QCOMPARE(z.length(), 1);
QDeclarativeDomProperty opacity = root.property("opacity");
- QCOMPARE(opacity.position(), 113);
+ QCOMPARE(opacity.position(), 127);
QCOMPARE(opacity.length(), 7);
QDeclarativeDomProperty data = root.property("data");
- QCOMPARE(data.position(), 138);
+ QCOMPARE(data.position(), 142);
QCOMPARE(data.length(), 0);
QDeclarativeDomProperty children = root.property("children");
- QCOMPARE(children.position(), 175);
+ QCOMPARE(children.position(), 179);
QCOMPARE(children.length(), 8);
QDeclarativeDomList dataList = data.value().toList();
@@ -1249,30 +1249,30 @@ void tst_qdeclarativedom::position()
// All QDeclarativeDomObject
QCOMPARE(root.position(), 14);
- QCOMPARE(root.length(), 191);
+ QCOMPARE(root.length(), 195);
QDeclarativeDomObject numberAnimation = z.value().toValueSource().object();
- QCOMPARE(numberAnimation.position(), 90);
- QCOMPARE(numberAnimation.length(), 18);
+ QCOMPARE(numberAnimation.position(), 87);
+ QCOMPARE(numberAnimation.length(), 23);
QDeclarativeDomObject behavior = opacity.value().toValueInterceptor().object();
- QCOMPARE(behavior.position(), 122);
- QCOMPARE(behavior.length(), 11);
+ QCOMPARE(behavior.position(), 115);
+ QCOMPARE(behavior.length(), 22);
QDeclarativeDomObject component = dataList.values().at(0).toObject();
- QCOMPARE(component.position(), 138);
+ QCOMPARE(component.position(), 142);
QCOMPARE(component.length(), 32);
QDeclarativeDomObject componentRoot = component.toComponent().componentRoot();
- QCOMPARE(componentRoot.position(), 158);
+ QCOMPARE(componentRoot.position(), 162);
QCOMPARE(componentRoot.length(), 6);
QDeclarativeDomObject child1 = childrenList.values().at(0).toObject();
- QCOMPARE(child1.position(), 187);
+ QCOMPARE(child1.position(), 191);
QCOMPARE(child1.length(), 6);
QDeclarativeDomObject child2 = childrenList.values().at(1).toObject();
- QCOMPARE(child2.position(), 195);
+ QCOMPARE(child2.position(), 199);
QCOMPARE(child2.length(), 6);
// All QDeclarativeDomValue
@@ -1285,23 +1285,23 @@ void tst_qdeclarativedom::position()
QCOMPARE(yValue.length(), 6);
QDeclarativeDomValue zValue = z.value();
- QCOMPARE(zValue.position(), 90);
- QCOMPARE(zValue.length(), 18);
+ QCOMPARE(zValue.position(), 87);
+ QCOMPARE(zValue.length(), 23);
QDeclarativeDomValue opacityValue = opacity.value();
- QCOMPARE(opacityValue.position(), 122);
- QCOMPARE(opacityValue.length(), 11);
+ QCOMPARE(opacityValue.position(), 115);
+ QCOMPARE(opacityValue.length(), 22);
QDeclarativeDomValue dataValue = data.value();
- QCOMPARE(dataValue.position(), 138);
+ QCOMPARE(dataValue.position(), 142);
QCOMPARE(dataValue.length(), 32);
QDeclarativeDomValue child1Value = childrenList.values().at(0);
- QCOMPARE(child1Value.position(), 187);
+ QCOMPARE(child1Value.position(), 191);
QCOMPARE(child1Value.length(), 6);
QDeclarativeDomValue child2Value = childrenList.values().at(1);
- QCOMPARE(child2Value.position(), 195);
+ QCOMPARE(child2Value.position(), 199);
QCOMPARE(child2Value.length(), 6);
// All QDeclarativeDomList
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml
new file mode 100644
index 0000000..4b5464d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+import Qt.test 1.0
+
+QtObject {
+ property int value: 9
+ property int value2
+
+ MyQmlObject.onMySignal: value2 = value
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml
index 3d45b15..5ba324a 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- property alias x: item.x
+ property alias blah: item.x
Item { id: item }
function testFunction() { return 9; }
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
new file mode 100644
index 0000000..4ad7f34
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+
+Item {
+ id: root
+
+ property int foo: 12
+ property int console: 11
+
+ property bool test1: foo == 12
+ property bool test2: console != 11
+ property bool test3: root.console == 11
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml
new file mode 100644
index 0000000..d65b6e7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: a
+ property int b: 9
+
+ property int test
+ property string test2
+
+ // Should resolve to signal arguments, not to other elements in the file
+ onArgumentSignal: { test = a; test2 = b; }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml
new file mode 100644
index 0000000..9b11fa9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property string result
+
+ Script{
+ function f() {
+ result = b
+ }
+
+ }
+ onArgumentSignal: f()
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml
new file mode 100644
index 0000000..ec727e2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property string result
+ property string aProp: "hello"
+
+ Script{
+ source: "scriptScope.js"
+ }
+ onBasicSignal: f()
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js
new file mode 100644
index 0000000..5689930
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js
@@ -0,0 +1,5 @@
+var aProp = "world";
+
+function f() {
+ result = aProp;
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 8fbd071..a283e3f 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -60,10 +60,21 @@ class MyQmlAttachedObject : public QObject
{
Q_OBJECT
Q_PROPERTY(int value READ value CONSTANT)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
public:
- MyQmlAttachedObject(QObject *parent) : QObject(parent) {}
+ MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {}
int value() const { return 19; }
+ int value2() const { return m_value2; }
+ void setValue2(int v) { m_value2 = v; }
+
+ void emitMySignal() { emit mySignal(); }
+
+signals:
+ void mySignal();
+
+private:
+ int m_value2;
};
class MyQmlObject : public QObject
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 60c380c..b5649cb 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -122,6 +122,8 @@ private slots:
void listToVariant();
void multiEngineObject();
void deletedObject();
+ void scriptScope();
+ void attachedPropertyScope();
void bug1();
@@ -728,6 +730,33 @@ void tst_qdeclarativeecmascript::scope()
QCOMPARE(object->property("test5").toInt(), 24);
QCOMPARE(object->property("test6").toInt(), 24);
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scope.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ }
+
+ // Signal argument scope
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scope.4.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ QCOMPARE(object->property("test2").toString(), QString());
+
+ emit object->argumentSignal(13, "Argument Scope", 9);
+
+ QCOMPARE(object->property("test").toInt(), 13);
+ QCOMPARE(object->property("test2").toString(), QString("Argument Scope"));
+
+ delete object;
+ }
}
/*
@@ -1657,6 +1686,51 @@ void tst_qdeclarativeecmascript::deletedObject()
delete object;
}
+void tst_qdeclarativeecmascript::scriptScope()
+{
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptScope.1.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ emit object->argumentSignal(19, "Hello world!", 10.3);
+ QCOMPARE(object->property("result").toString(), QString());
+
+ delete object;
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptScope.2.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ emit object->basicSignal();
+ QCOMPARE(object->property("result").toString(), QLatin1String("world"));
+
+ delete object;
+ }
+}
+
+void tst_qdeclarativeecmascript::attachedPropertyScope()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("attachedPropertyScope.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ MyQmlAttachedObject *attached =
+ qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object));
+ QVERIFY(attached != 0);
+
+ QCOMPARE(object->property("value2").toInt(), 0);
+
+ attached->emitMySignal();
+
+ QCOMPARE(object->property("value2").toInt(), 9);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"
diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml
index 344b4b5..ba6b807 100644
--- a/tests/auto/declarative/qdeclarativegridview/data/gridview.qml
+++ b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml
@@ -1,6 +1,10 @@
import Qt 4.6
Rectangle {
+ id: root
+ property int added: -1
+ property var removed
+
width: 240
height: 320
color: "#ffffff"
@@ -33,6 +37,8 @@ Rectangle {
text: number
}
color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ GridView.onAdd: root.added = index
+ GridView.onRemove: root.removed = name
}
}
]
diff --git a/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml
new file mode 100644
index 0000000..da2e8d0
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml
@@ -0,0 +1,69 @@
+import Qt 4.6
+
+Rectangle {
+ width: 360; height: 120; color: "white"
+ Component {
+ id: delegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+ Component {
+ id: highlightRed
+ Rectangle {
+ color: "red"
+ radius: 10
+ opacity: 0.5
+ }
+ }
+ GridView {
+ cellWidth:180
+ cellHeight:40
+ objectName: "gridView"
+ anchors.fill: parent
+ model: listModel
+ delegate: delegate
+ highlight: highlightRed
+ focus: true
+ keyNavigationWraps: true
+ cacheBuffer: 10
+ flow: GridView.LeftToRight
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ }
+ ]
+}
+
+ \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index 2a60fee..7ade309 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -39,16 +39,17 @@
**
****************************************************************************/
-#include <qdeclarativeengine.h>
-#include <qdeclarativecomponent.h>
-#include <QStringListModel>
#include <QtTest/QtTest>
-#include <private/qlistmodelinterface_p.h>
-#include <qdeclarativeview.h>
-#include <private/qdeclarativegridview_p.h>
-#include <private/qdeclarativetext_p.h>
-#include <qdeclarativecontext.h>
-#include <qdeclarativeexpression.h>
+#include <QtGui/qstringlistmodel.h>
+#include <QtDeclarative/qdeclarativeview.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeexpression.h>
+#include <QtDeclarative/private/qlistmodelinterface_p.h>
+#include <QtDeclarative/private/qdeclarativegridview_p.h>
+#include <QtDeclarative/private/qdeclarativetext_p.h>
+#include <QtDeclarative/private/qdeclarativelistmodel_p.h>
class tst_QDeclarativeGridView : public QObject
{
@@ -66,6 +67,9 @@ private slots:
void currentIndex();
void defaultValues();
void properties();
+ void propertyChanges();
+ void componentChanges();
+ void modelChanges();
void positionViewAtIndex();
void resetModel();
void QTBUG_8456();
@@ -91,7 +95,7 @@ public:
setRoleNames(roles);
}
- int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); }
+ int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); }
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const {
QVariant rv;
if (role == Name)
@@ -253,7 +257,7 @@ void tst_QDeclarativeGridView::inserted()
model.insertItem(1, "Will", "9876");
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
@@ -264,6 +268,10 @@ void tst_QDeclarativeGridView::inserted()
QVERIFY(number != 0);
QCOMPARE(number->text(), model.number(1));
+ // Checks that onAdd is called
+ int added = canvas->rootObject()->property("added").toInt();
+ QCOMPARE(added, 1);
+
// Confirm items positioned correctly
for (int i = 0; i < model.count(); ++i) {
QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i);
@@ -274,7 +282,7 @@ void tst_QDeclarativeGridView::inserted()
model.insertItem(0, "Foo", "1111"); // zero index, and current item
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
@@ -296,14 +304,14 @@ void tst_QDeclarativeGridView::inserted()
for (int i = model.count(); i < 30; ++i)
model.insertItem(i, "Hello", QString::number(i));
- QTest::qWait(300);
+ QTest::qWait(100);
gridview->setContentY(120);
- QTest::qWait(300);
+ QTest::qWait(100);
// Insert item outside visible area
model.insertItem(1, "Hello", "1324");
- QTest::qWait(300);
+ QTest::qWait(100);
QVERIFY(gridview->contentY() == 120);
@@ -334,7 +342,7 @@ void tst_QDeclarativeGridView::removed()
model.removeItem(1);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1);
QVERIFY(name != 0);
@@ -343,6 +351,10 @@ void tst_QDeclarativeGridView::removed()
QVERIFY(number != 0);
QCOMPARE(number->text(), model.number(1));
+ // Checks that onRemove is called
+ QString removed = canvas->rootObject()->property("removed").toString();
+ QCOMPARE(removed, QString("Item1"));
+
// Confirm items positioned correctly
int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count();
for (int i = 0; i < model.count() && i < itemCount; ++i) {
@@ -357,7 +369,7 @@ void tst_QDeclarativeGridView::removed()
model.removeItem(0);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
name = findItem<QDeclarativeText>(viewport, "textName", 0);
QVERIFY(name != 0);
@@ -379,7 +391,7 @@ void tst_QDeclarativeGridView::removed()
// Remove items not visible
model.removeItem(25);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
// Confirm items positioned correctly
itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count();
@@ -393,11 +405,11 @@ void tst_QDeclarativeGridView::removed()
// Remove items before visible
gridview->setContentY(120);
- QTest::qWait(500);
+ QTest::qWait(100);
gridview->setCurrentIndex(10);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
// Setting currentIndex above shouldn't cause view to scroll
QCOMPARE(gridview->contentY(), 120.0);
@@ -405,7 +417,7 @@ void tst_QDeclarativeGridView::removed()
model.removeItem(1);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
// Confirm items positioned correctly
for (int i = 6; i < 18; ++i) {
@@ -419,14 +431,14 @@ void tst_QDeclarativeGridView::removed()
// Remove currentIndex
QDeclarativeItem *oldCurrent = gridview->currentItem();
model.removeItem(9);
- QTest::qWait(500);
+ QTest::qWait(100);
QCOMPARE(gridview->currentIndex(), 9);
QVERIFY(gridview->currentItem() != oldCurrent);
gridview->setContentY(0);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
// Confirm items positioned correctly
itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count();
@@ -440,7 +452,7 @@ void tst_QDeclarativeGridView::removed()
// remove item outside current view.
gridview->setCurrentIndex(32);
- QTest::qWait(500);
+ QTest::qWait(100);
gridview->setContentY(240);
model.removeItem(30);
@@ -448,21 +460,21 @@ void tst_QDeclarativeGridView::removed()
// remove current item beyond visible items.
gridview->setCurrentIndex(20);
- QTest::qWait(500);
+ QTest::qWait(100);
gridview->setContentY(0);
model.removeItem(20);
- QTest::qWait(500);
+ QTest::qWait(100);
QCOMPARE(gridview->currentIndex(), 20);
QVERIFY(gridview->currentItem() != 0);
// remove item before current, but visible
gridview->setCurrentIndex(8);
- QTest::qWait(500);
+ QTest::qWait(100);
gridview->setContentY(240);
oldCurrent = gridview->currentItem();
model.removeItem(6);
- QTest::qWait(500);
+ QTest::qWait(100);
QCOMPARE(gridview->currentIndex(), 7);
QVERIFY(gridview->currentItem() == oldCurrent);
@@ -494,7 +506,7 @@ void tst_QDeclarativeGridView::moved()
model.moveItem(1, 8);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1);
QVERIFY(name != 0);
@@ -526,7 +538,7 @@ void tst_QDeclarativeGridView::moved()
model.moveItem(1, 25);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
// Confirm items positioned correctly and indexes correct
itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count()-1;
@@ -548,7 +560,7 @@ void tst_QDeclarativeGridView::moved()
model.moveItem(28, 8);
// let transitions settle.
- QTest::qWait(300);
+ QTest::qWait(100);
// Confirm items positioned correctly and indexes correct
for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) {
@@ -591,7 +603,7 @@ void tst_QDeclarativeGridView::currentIndex()
QDeclarativeItem *viewport = gridview->viewport();
QVERIFY(viewport != 0);
- QTest::qWait(500);
+ QTest::qWait(300);
// current item should be third item
QCOMPARE(gridview->currentIndex(), 5);
@@ -618,7 +630,7 @@ void tst_QDeclarativeGridView::currentIndex()
QCOMPARE(gridview->currentIndex(), 0);
gridview->setCurrentIndex(model.count()-1);
- QTest::qWait(500);
+ QTest::qWait(100);
QCOMPARE(gridview->currentIndex(), model.count()-1);
gridview->moveCurrentIndexRight();
@@ -677,8 +689,6 @@ void tst_QDeclarativeGridView::currentIndex()
// turn off auto highlight
gridview->setHighlightFollowsCurrentItem(false);
QVERIFY(gridview->highlightFollowsCurrentItem() == false);
-
- QTest::qWait(500);
QVERIFY(gridview->highlightItem());
qreal hlPosX = gridview->highlightItem()->x();
qreal hlPosY = gridview->highlightItem()->y();
@@ -729,7 +739,7 @@ void tst_QDeclarativeGridView::changeFlow()
}
ctxt->setContextProperty("testTopToBottom", QVariant(true));
- QTest::qWait(500);
+ QTest::qWait(100);
// Confirm items positioned correctly and indexes correct
itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count();
@@ -796,6 +806,107 @@ void tst_QDeclarativeGridView::properties()
delete obj;
}
+void tst_QDeclarativeGridView::propertyChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView");
+ QVERIFY(gridView);
+
+ QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged()));
+ QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged()));
+ QSignalSpy flowSpy(gridView, SIGNAL(flowChanged()));
+
+ QCOMPARE(gridView->isWrapEnabled(), true);
+ QCOMPARE(gridView->cacheBuffer(), 10);
+ QCOMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight);
+
+ gridView->setWrapEnabled(false);
+ gridView->setCacheBuffer(3);
+ gridView->setFlow(QDeclarativeGridView::TopToBottom);
+
+ QCOMPARE(gridView->isWrapEnabled(), false);
+ QCOMPARE(gridView->cacheBuffer(), 3);
+ QCOMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom);
+
+ QCOMPARE(keyNavigationWrapsSpy.count(),1);
+ QCOMPARE(cacheBufferSpy.count(),1);
+ QCOMPARE(flowSpy.count(),1);
+
+ gridView->setWrapEnabled(false);
+ gridView->setCacheBuffer(3);
+ gridView->setFlow(QDeclarativeGridView::TopToBottom);
+
+ QCOMPARE(keyNavigationWrapsSpy.count(),1);
+ QCOMPARE(cacheBufferSpy.count(),1);
+ QCOMPARE(flowSpy.count(),1);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeGridView::componentChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView");
+ QVERIFY(gridView);
+
+ QDeclarativeComponent component(canvas->engine());
+ component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile(""));
+
+ QDeclarativeComponent delegateComponent(canvas->engine());
+ delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile(""));
+
+ QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged()));
+ QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged()));
+
+ gridView->setHighlight(&component);
+ gridView->setDelegate(&delegateComponent);
+
+ QCOMPARE(gridView->highlight(), &component);
+ QCOMPARE(gridView->delegate(), &delegateComponent);
+
+ QCOMPARE(highlightSpy.count(),1);
+ QCOMPARE(delegateSpy.count(),1);
+
+ gridView->setHighlight(&component);
+ gridView->setDelegate(&delegateComponent);
+
+ QCOMPARE(highlightSpy.count(),1);
+ QCOMPARE(delegateSpy.count(),1);
+ delete canvas;
+}
+
+void tst_QDeclarativeGridView::modelChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView");
+ QVERIFY(gridView);
+
+ QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel");
+ QVERIFY(alternateModel);
+ QVariant modelVariant = QVariant::fromValue(alternateModel);
+ QSignalSpy modelSpy(gridView, SIGNAL(modelChanged()));
+
+ gridView->setModel(modelVariant);
+ QCOMPARE(gridView->model(), modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ gridView->setModel(modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ gridView->setModel(QVariant());
+ QCOMPARE(modelSpy.count(),2);
+ delete canvas;
+}
+
void tst_QDeclarativeGridView::positionViewAtIndex()
{
QDeclarativeView *canvas = createView();
diff --git a/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml b/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml
index 9281a17..08da901 100644
--- a/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml
+++ b/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml
@@ -11,6 +11,8 @@ Grid {
color: focus ? "red" : "lightgray"
KeyNavigation.right: item2
KeyNavigation.down: item3
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
}
Rectangle {
id: item2
@@ -19,6 +21,8 @@ Grid {
color: focus ? "red" : "lightgray"
KeyNavigation.left: item1
KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
}
Rectangle {
id: item3
@@ -27,6 +31,8 @@ Grid {
color: focus ? "red" : "lightgray"
KeyNavigation.right: item4
KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
}
Rectangle {
id: item4
@@ -35,5 +41,7 @@ Grid {
color: focus ? "red" : "lightgray"
KeyNavigation.left: item3
KeyNavigation.up: item2
+ KeyNavigation.tab: item1
+ KeyNavigation.backtab: item3
}
}
diff --git a/tests/auto/declarative/qdeclarativeitem/data/keys.qml b/tests/auto/declarative/qdeclarativeitem/data/keys.qml
index f3c1f7b..7d34fc8 100644
--- a/tests/auto/declarative/qdeclarativeitem/data/keys.qml
+++ b/tests/auto/declarative/qdeclarativeitem/data/keys.qml
@@ -7,6 +7,8 @@ Item {
Keys.onReturnPressed: keysTestObject.keyPress(event.key, "Return", event.modifiers)
Keys.onDigit0Pressed: keysTestObject.keyPress(event.key, event.text, event.modifiers)
Keys.onDigit9Pressed: { event.accepted = false; keysTestObject.keyPress(event.key, event.text, event.modifiers) }
+ Keys.onTabPressed: keysTestObject.keyPress(event.key, "Tab", event.modifiers)
+ Keys.onBacktabPressed: keysTestObject.keyPress(event.key, "Backtab", event.modifiers)
Keys.forwardTo: [ item2 ]
Keys.enabled: enableKeyHanding
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 36dcf1f..dbcba16 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -176,6 +176,26 @@ void tst_QDeclarativeItem::keys()
testObject->reset();
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Tab));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Tab));
+ QCOMPARE(testObject->mText, QLatin1String("Tab"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Backtab));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Backtab));
+ QCOMPARE(testObject->mText, QLatin1String("Backtab"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(false));
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
@@ -240,6 +260,24 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1");
QVERIFY(item);
QVERIFY(item->hasFocus());
+
+ // tab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QDeclarativeItem>(canvas->rootObject(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
+
+ // backtab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasFocus());
}
void tst_QDeclarativeItem::smooth()
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
index c86c96b..9fe0ded 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml
@@ -10,8 +10,6 @@ MyTypeObject {
floatProperty: 8.5
colorProperty: "red"
dateProperty: "1982-11-25"
- timeProperty: "11:11:31"
- timeProperty: "11:11:32"
timeProperty: "11:11:32"
dateTimeProperty: "2009-05-12T13:22:01"
pointProperty: "99,13"
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt
index 9a13142..450fc16 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt
@@ -1 +1 @@
-6:9:Invalid component id specification
+6:9:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml
new file mode 100644
index 0000000..7cd6a83
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+
+QtObject {
+ property int on
+
+ Component.onCompleted: on = 10
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt
index 945d51b..32055f6 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt
@@ -1 +1 @@
-7:9:Invalid value in grouped property
+7:9:Cannot assign a value directly to a grouped property
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt
index 2aea251..e1f7ec5 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt
@@ -1 +1 @@
-5:5:Incorrectly specified signal
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt
new file mode 100644
index 0000000..1fcb1b6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt
@@ -0,0 +1 @@
+4:14:Cannot assign a value directly to a grouped property
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml
new file mode 100644
index 0000000..41aa3e2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped: "10x10"
+ grouped.value: 10
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt
index 8331725..e1f7ec5 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt
@@ -1 +1 @@
-5:18:Single property assignment expected
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt
new file mode 100644
index 0000000..fa0da21
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt
@@ -0,0 +1 @@
+5:19:Property has already been assigned a value
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml
new file mode 100644
index 0000000..56fca9b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ pointProperty: "10x10"
+ pointProperty.x: 10
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt
new file mode 100644
index 0000000..6d837a7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt
@@ -0,0 +1 @@
+5:20:Property has already been assigned a value
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml
new file mode 100644
index 0000000..982ab26
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ pointProperty.x: 10
+ pointProperty: "10x10"
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt
index 56e3eeb..2c6b8bf 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt
@@ -1,2 +1,2 @@
-3:5:"" is not a valid object id
+3:9:Invalid empty ID
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt
index cfe8756..c721fe9 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt
@@ -1 +1 @@
-4:5:Invalid use of id property
+4:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt
index 160e8b5..7251de1 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt
@@ -1 +1 @@
-3:5:"StartsWithUpperCase" is not a valid object id
+3:9:IDs cannot start with an uppercase letter
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt
new file mode 100644
index 0000000..e4fd1db
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt
@@ -0,0 +1 @@
+3:9:ID illegally masks global JavaScript property
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml
new file mode 100644
index 0000000..d4bc539
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: gc
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt
new file mode 100644
index 0000000..b03ec6c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must contain only letters, numbers, and underscores
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml
new file mode 100644
index 0000000..1ea615c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: hello.world
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt
new file mode 100644
index 0000000..c010e79
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must start with a letter or underscore
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml
new file mode 100644
index 0000000..57474b7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: "3hello"
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt
index 1ca678c..c010e79 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt
@@ -1 +1 @@
-3:5:"1" is not a valid object id
+3:9:IDs must start with a letter or underscore
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt
index 8c7b7e9..c721fe9 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt
@@ -1 +1 @@
-4:15:Can only assign one binding to lists
+4:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml
new file mode 100644
index 0000000..649c49e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 10
+ intProperty: 11
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml
new file mode 100644
index 0000000..bc21db9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ property int a: 10
+ a: 11
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml
new file mode 100644
index 0000000..abcd216
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 10
+ intProperty: a + 10
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml
new file mode 100644
index 0000000..77eaba0
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: a + 10
+ intProperty: 10
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml
new file mode 100644
index 0000000..c16d04f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 10
+ intProperty: MyTypeObject {}
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml
new file mode 100644
index 0000000..2980c5b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyContainer {
+ children: MyContainer {}
+ children: MyContainer {}
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml
new file mode 100644
index 0000000..492c720
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyContainer {
+ children: MyContainer {}
+ children: [ MyContainer {}, MyContainer {} ]
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml
new file mode 100644
index 0000000..2a9c1d0
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyContainer {
+ children: [ MyContainer {}, MyContainer {} ]
+ children: MyContainer {}
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt
new file mode 100644
index 0000000..450fc16
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt
@@ -0,0 +1 @@
+6:9:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml
new file mode 100644
index 0000000..052437e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped {
+ value: 10
+ value: 11
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt
new file mode 100644
index 0000000..e1f7ec5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml
new file mode 100644
index 0000000..e2e954f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped.value: 10
+ grouped.value: 11
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml
index 57a6070..e48526a 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml
@@ -1,5 +1,5 @@
import Test 1.0
MyTypeObject {
- intProperty : MyCompositeValueSource {}
+ MyCompositeValueSource on intProperty {}
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml
index ad71fcf..22aa682 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml
@@ -1,4 +1,4 @@
import Test 1.0
MyTypeObject {
- intProperty : MyPropertyValueSource {}
+ MyPropertyValueSource on intProperty {}
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt
index b5bf1a8..450fc16 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt
@@ -1 +1 @@
-6:9:Invalid Script source value
+6:9:Property value set multiple times
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index 09cddcb..df93dc8 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -78,17 +78,20 @@ Q_DECLARE_METATYPE(MyCustomVariantType);
class MyAttachedObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(int value2 READ value2 WRITE setValue2)
public:
MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {}
int value() const { return m_value; }
- void setValue(int v) { m_value = v; }
+ void setValue(int v) { if (m_value != v) { m_value = v; emit valueChanged(); } }
int value2() const { return m_value2; }
void setValue2(int v) { m_value2 = v; }
+signals:
+ void valueChanged();
+
private:
int m_value;
int m_value2;
@@ -169,11 +172,16 @@ class MyGroupedObject : public QObject
{
Q_OBJECT
Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript);
+ Q_PROPERTY(int value READ value WRITE setValue);
public:
QDeclarativeScriptString script() const { return m_script; }
void setScript(const QDeclarativeScriptString &s) { m_script = s; }
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
private:
+ int m_value;
QDeclarativeScriptString m_script;
};
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 1ba4454..3ce15cb 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -128,6 +128,8 @@ private slots:
void qmlAttachedPropertiesObjectMethod();
+ void customOnProperty();
+
// regression tests for crashes
void crash1();
void crash2();
@@ -232,6 +234,9 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("invalidID.4") << "invalidID.4.qml" << "invalidID.4.errors.txt" << false;
QTest::newRow("invalidID.5") << "invalidID.5.qml" << "invalidID.5.errors.txt" << false;
QTest::newRow("invalidID.6") << "invalidID.6.qml" << "invalidID.6.errors.txt" << false;
+ QTest::newRow("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false;
+ QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false;
+ QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false;
QTest::newRow("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false;
QTest::newRow("nullDotProperty") << "nullDotProperty.qml" << "nullDotProperty.errors.txt" << true;
@@ -252,6 +257,9 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("invalidGroupedProperty.5") << "invalidGroupedProperty.5.qml" << "invalidGroupedProperty.5.errors.txt" << false;
QTest::newRow("invalidGroupedProperty.6") << "invalidGroupedProperty.6.qml" << "invalidGroupedProperty.6.errors.txt" << false;
QTest::newRow("invalidGroupedProperty.7") << "invalidGroupedProperty.7.qml" << "invalidGroupedProperty.7.errors.txt" << true;
+ QTest::newRow("invalidGroupedProperty.8") << "invalidGroupedProperty.8.qml" << "invalidGroupedProperty.8.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.9") << "invalidGroupedProperty.9.qml" << "invalidGroupedProperty.9.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.10") << "invalidGroupedProperty.10.qml" << "invalidGroupedProperty.10.errors.txt" << false;
QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false;
QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false;
@@ -288,6 +296,17 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("Component.5") << "component.5.qml" << "component.5.errors.txt" << false;
QTest::newRow("Component.6") << "component.6.qml" << "component.6.errors.txt" << false;
+ QTest::newRow("MultiSet.1") << "multiSet.1.qml" << "multiSet.1.errors.txt" << false;
+ QTest::newRow("MultiSet.2") << "multiSet.2.qml" << "multiSet.2.errors.txt" << false;
+ QTest::newRow("MultiSet.3") << "multiSet.3.qml" << "multiSet.3.errors.txt" << false;
+ QTest::newRow("MultiSet.4") << "multiSet.4.qml" << "multiSet.4.errors.txt" << false;
+ QTest::newRow("MultiSet.5") << "multiSet.5.qml" << "multiSet.5.errors.txt" << false;
+ QTest::newRow("MultiSet.6") << "multiSet.6.qml" << "multiSet.6.errors.txt" << false;
+ QTest::newRow("MultiSet.7") << "multiSet.7.qml" << "multiSet.7.errors.txt" << false;
+ QTest::newRow("MultiSet.8") << "multiSet.8.qml" << "multiSet.8.errors.txt" << false;
+ QTest::newRow("MultiSet.9") << "multiSet.9.qml" << "multiSet.9.errors.txt" << false;
+ QTest::newRow("MultiSet.10") << "multiSet.10.qml" << "multiSet.10.errors.txt" << false;
+
QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false;
QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false;
QTest::newRow("invalidAttachedProperty.3") << "invalidAttachedProperty.3.qml" << "invalidAttachedProperty.3.errors.txt" << false;
@@ -316,9 +335,6 @@ void tst_qdeclarativelanguage::errors()
QFETCH(QString, errorFile);
QFETCH(bool, create);
- if (file == "invalidID.6.qml")
- QTest::ignoreMessage(QtWarningMsg, "id \"StartsWithUpperCase\" is invalid: ids cannot start with uppercase letters");
-
QDeclarativeComponent component(&engine, TEST_FILE(file));
if(create) {
@@ -1378,6 +1394,19 @@ void tst_qdeclarativelanguage::crash2()
QDeclarativeComponent component(&engine, TEST_FILE("crash2.qml"));
}
+// QTBUG-8676
+void tst_qdeclarativelanguage::customOnProperty()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("customOnProperty.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("on").toInt(), 10);
+
+ delete object;
+}
void tst_qdeclarativelanguage::initTestCase()
{
diff --git a/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml
new file mode 100644
index 0000000..a41f003
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml
@@ -0,0 +1,71 @@
+import Qt 4.6
+
+Rectangle {
+ width: 180; height: 120; color: "white"
+ Component {
+ id: delegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+ Component {
+ id: highlightRed
+ Rectangle {
+ color: "red"
+ radius: 10
+ opacity: 0.5
+ }
+ }
+ ListView {
+ objectName: "listView"
+ anchors.fill: parent
+ model: listModel
+ delegate: delegate
+ highlight: highlightRed
+ focus: true
+ highlightFollowsCurrentItem: true
+ preferredHighlightBegin: 0.0
+ preferredHighlightEnd: 0.0
+ highlightRangeMode: ListView.ApplyRange
+ keyNavigationWraps: true
+ cacheBuffer: 10
+ snapMode: ListView.SnapToItem
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ }
+ ]
+}
+
+ \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index f15f26b..a36224f 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -38,15 +38,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QtTest/QtTest>
-#include <QStringListModel>
-#include <private/qlistmodelinterface_p.h>
-#include <qdeclarativeview.h>
-#include <private/qdeclarativelistview_p.h>
-#include <private/qdeclarativetext_p.h>
-#include <private/qdeclarativevisualitemmodel_p.h>
-#include <qdeclarativecontext.h>
-#include <qdeclarativeexpression.h>
+#include <QtGui/QStringListModel>
+#include <QtDeclarative/qdeclarativeview.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeexpression.h>
+#include <QtDeclarative/private/qdeclarativelistview_p.h>
+#include <QtDeclarative/private/qdeclarativetext_p.h>
+#include <QtDeclarative/private/qdeclarativevisualitemmodel_p.h>
+#include <QtDeclarative/private/qdeclarativelistmodel_p.h>
+#include <QtDeclarative/private/qlistmodelinterface_p.h>
class tst_QDeclarativeListView : public QObject
{
@@ -82,6 +85,9 @@ private slots:
void cacheBuffer();
void positionViewAtIndex();
void resetModel();
+ void propertyChanges();
+ void componentChanges();
+ void modelChanges();
private:
template <class T> void items();
@@ -240,7 +246,7 @@ public:
setRoleNames(roles);
}
- int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); }
+ int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); }
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const {
QVariant rv;
if (role == Name)
@@ -379,6 +385,7 @@ void tst_QDeclarativeListView::items()
delete canvas;
}
+
template <class T>
void tst_QDeclarativeListView::changed()
{
@@ -1275,6 +1282,149 @@ void tst_QDeclarativeListView::resetModel()
}
}
+void tst_QDeclarativeListView::propertyChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView");
+ QVERIFY(listView);
+
+ QSignalSpy highlightFollowsCurrentItemSpy(listView, SIGNAL(highlightFollowsCurrentItemChanged()));
+ QSignalSpy preferredHighlightBeginSpy(listView, SIGNAL(preferredHighlightBeginChanged()));
+ QSignalSpy preferredHighlightEndSpy(listView, SIGNAL(preferredHighlightEndChanged()));
+ QSignalSpy highlightRangeModeSpy(listView, SIGNAL(highlightRangeModeChanged()));
+ QSignalSpy keyNavigationWrapsSpy(listView, SIGNAL(keyNavigationWrapsChanged()));
+ QSignalSpy cacheBufferSpy(listView, SIGNAL(cacheBufferChanged()));
+ QSignalSpy snapModeSpy(listView, SIGNAL(snapModeChanged()));
+
+ QCOMPARE(listView->highlightFollowsCurrentItem(), true);
+ QCOMPARE(listView->preferredHighlightBegin(), 0.0);
+ QCOMPARE(listView->preferredHighlightEnd(), 0.0);
+ QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange);
+ QCOMPARE(listView->isWrapEnabled(), true);
+ QCOMPARE(listView->cacheBuffer(), 10);
+ QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem);
+
+ listView->setHighlightFollowsCurrentItem(false);
+ listView->setPreferredHighlightBegin(1.0);
+ listView->setPreferredHighlightEnd(1.0);
+ listView->setHighlightRangeMode(QDeclarativeListView::StrictlyEnforceRange);
+ listView->setWrapEnabled(false);
+ listView->setCacheBuffer(3);
+ listView->setSnapMode(QDeclarativeListView::SnapOneItem);
+
+ QCOMPARE(listView->highlightFollowsCurrentItem(), false);
+ QCOMPARE(listView->preferredHighlightBegin(), 1.0);
+ QCOMPARE(listView->preferredHighlightEnd(), 1.0);
+ QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange);
+ QCOMPARE(listView->isWrapEnabled(), false);
+ QCOMPARE(listView->cacheBuffer(), 3);
+ QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem);
+
+ QCOMPARE(highlightFollowsCurrentItemSpy.count(),1);
+ QCOMPARE(preferredHighlightBeginSpy.count(),1);
+ QCOMPARE(preferredHighlightEndSpy.count(),1);
+ QCOMPARE(highlightRangeModeSpy.count(),1);
+ QCOMPARE(keyNavigationWrapsSpy.count(),1);
+ QCOMPARE(cacheBufferSpy.count(),1);
+ QCOMPARE(snapModeSpy.count(),1);
+
+ listView->setHighlightFollowsCurrentItem(false);
+ listView->setPreferredHighlightBegin(1.0);
+ listView->setPreferredHighlightEnd(1.0);
+ listView->setHighlightRangeMode(QDeclarativeListView::StrictlyEnforceRange);
+ listView->setWrapEnabled(false);
+ listView->setCacheBuffer(3);
+ listView->setSnapMode(QDeclarativeListView::SnapOneItem);
+
+ QCOMPARE(highlightFollowsCurrentItemSpy.count(),1);
+ QCOMPARE(preferredHighlightBeginSpy.count(),1);
+ QCOMPARE(preferredHighlightEndSpy.count(),1);
+ QCOMPARE(highlightRangeModeSpy.count(),1);
+ QCOMPARE(keyNavigationWrapsSpy.count(),1);
+ QCOMPARE(cacheBufferSpy.count(),1);
+ QCOMPARE(snapModeSpy.count(),1);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeListView::componentChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView");
+ QVERIFY(listView);
+
+ QDeclarativeComponent component(canvas->engine());
+ component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile(""));
+
+ QDeclarativeComponent delegateComponent(canvas->engine());
+ delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile(""));
+
+ QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged()));
+ QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged()));
+ QSignalSpy headerSpy(listView, SIGNAL(headerChanged()));
+ QSignalSpy footerSpy(listView, SIGNAL(footerChanged()));
+
+ listView->setHighlight(&component);
+ listView->setHeader(&component);
+ listView->setFooter(&component);
+ listView->setDelegate(&delegateComponent);
+
+ QCOMPARE(listView->highlight(), &component);
+ QCOMPARE(listView->header(), &component);
+ QCOMPARE(listView->footer(), &component);
+ QCOMPARE(listView->delegate(), &delegateComponent);
+
+ QCOMPARE(highlightSpy.count(),1);
+ QCOMPARE(delegateSpy.count(),1);
+ QCOMPARE(headerSpy.count(),1);
+ QCOMPARE(footerSpy.count(),1);
+
+ listView->setHighlight(&component);
+ listView->setHeader(&component);
+ listView->setFooter(&component);
+ listView->setDelegate(&delegateComponent);
+
+ QCOMPARE(highlightSpy.count(),1);
+ QCOMPARE(delegateSpy.count(),1);
+ QCOMPARE(headerSpy.count(),1);
+ QCOMPARE(footerSpy.count(),1);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeListView::modelChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView");
+ QVERIFY(listView);
+
+ QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel");
+ QVERIFY(alternateModel);
+ QVariant modelVariant = QVariant::fromValue(alternateModel);
+ QSignalSpy modelSpy(listView, SIGNAL(modelChanged()));
+
+ listView->setModel(modelVariant);
+ QCOMPARE(listView->model(), modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ listView->setModel(modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ listView->setModel(QVariant());
+ QCOMPARE(modelSpy.count(),2);
+
+ delete canvas;
+}
+
void tst_QDeclarativeListView::qListModelInterface_items()
{
items<TestModel>();
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index f3caa7f..92f7aef 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -50,7 +50,6 @@ class tst_qdeclarativemoduleplugin : public QObject
public:
tst_qdeclarativemoduleplugin() {
QCoreApplication::addLibraryPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin"));
-qDebug() << QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin");
}
private slots:
diff --git a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp
index 26ff3d5..a9a0077 100644
--- a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp
+++ b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp
@@ -172,9 +172,11 @@ tst_qdeclarativenumberformatter::tst_qdeclarativenumberformatter()
<< "00,000,001.0000"
<< "00,000,001.0100"; // end
+ /*
qDebug() << "strings.size()" << strings.size()
<< "\nformats.size()" << formats.size()
<< "texts.size()" << texts.size();
+ */
}
void tst_qdeclarativenumberformatter::text_data()
diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml
index c58927e..0d42645 100644
--- a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml
+++ b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml
@@ -8,7 +8,7 @@ Rectangle{
objectName: "particles"
width:1; height:1; anchors.centerIn: parent; opacity: 1
lifeSpan: 100; lifeSpanDeviation: 20; count:1000;
- fadeInDuration: 20; fadeOutDuration: 20; count: -1; emissionRate: 1000
+ fadeInDuration: 20; fadeOutDuration: 20; emissionRate: 1000
angle: 0; angleDeviation: 360; velocity: 500; velocityDeviation:30
source: "particle.png"
}
diff --git a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml
index 627f38a..ab1538b 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml
@@ -33,7 +33,7 @@ Rectangle {
height: 320
model: testModel
delegate: delegate
- snapPosition: 0.01
+ snapPosition: 0.0001
path: Path {
startY: 120
startX: 160
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml
index 8fa8d59..c5d88cd 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/pathview.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml
@@ -39,7 +39,7 @@ Rectangle {
height: 320
model: testModel
delegate: delegate
- snapPosition: 0.01
+ snapPosition: 0.0001
path: Path {
startY: 120
startX: 160
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml
index 0d5c98b..c825292 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml
@@ -1,7 +1,7 @@
import Qt 4.6
PathView {
- id: photoPathView; model: rssModel; delegate: photoDelegate
+ id: photoPathView
y: 100; width: 800; height: 330; pathItemCount: 10; z: 1
path: Path {
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml
index 412cca2..f8ed29f 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml
@@ -1,9 +1,9 @@
import Qt 4.6
PathView {
- id: photoPathView; model: rssModel; delegate: photoDelegate
+ id: photoPathView
y: 100; width: 800; height: 330; pathItemCount: 4; offset: 10
- dragMargin: 24; snapPosition: 50
+ dragMargin: 24; snapPosition: 0.50
path: Path {
startX: -50; startY: 40;
diff --git a/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml
new file mode 100644
index 0000000..db70b7b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml
@@ -0,0 +1,115 @@
+import Qt 4.6
+
+Rectangle {
+ width: 350; height: 220; color: "white"
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ opacity: PathView.opacity
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+
+ PathView {
+ snapPosition: 0.1
+ dragMargin: 5.0
+ id: pathView
+ objectName: "pathView"
+ anchors.fill: parent
+ model: listModel
+ delegate: myDelegate
+ focus: true
+ path: Path {
+ id: myPath
+ objectName: "path"
+ startX: 220; startY: 200
+ PathAttribute { name: "opacity"; value: 1.0; objectName: "pathAttribute"; }
+ PathQuad { x: 220; y: 25; controlX: 260; controlY: 75 }
+ PathAttribute { name: "opacity"; value: 0.3 }
+ PathQuad { x: 220; y: 200; controlX: -20; controlY: 75 }
+ }
+ Timer {
+ interval: 2000; running: true; repeat: true
+ onTriggered: {
+ if (pathView.path == alternatePath)
+ pathView.path = myPath;
+ else
+ pathView.path = alternatePath;
+ }
+ }
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ },
+ Path {
+ id: alternatePath
+ objectName: "alternatePath"
+ startX: 100; startY: 40
+ PathAttribute { name: "opacity"; value: 0.0 }
+ PathLine { x: 100; y: 160 }
+ PathAttribute { name: "opacity"; value: 0.2 }
+ PathLine { x: 300; y: 160 }
+ PathAttribute { name: "opacity"; value: 0.0 }
+ PathLine { x: 300; y: 40 }
+ PathAttribute { name: "opacity"; value: 0.2 }
+ PathLine { x: 100; y: 40 }
+ }
+ ]
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 79bc607..fa4e9d3 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -38,20 +38,23 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <private/qdeclarativepathview_p.h>
-#include <private/qdeclarativepath_p.h>
-#include <qdeclarativecontext.h>
-#include <qdeclarativeexpression.h>
-#include <qtest.h>
+
+#include <QtTest/QtTest>
+#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
-#include <QtDeclarative/qdeclarativeview.h>
+#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeexpression.h>
+#include <QtDeclarative/private/qdeclarativepathview_p.h>
+#include <QtDeclarative/private/qdeclarativepath_p.h>
#include <QtDeclarative/private/qdeclarativetext_p.h>
#include <QtDeclarative/private/qdeclarativerectangle_p.h>
+#include <QtDeclarative/private/qdeclarativelistmodel_p.h>
+#include <QtDeclarative/private/qdeclarativevaluetype_p.h>
#include <QAbstractListModel>
#include <QStringListModel>
#include <QFile>
-#include <private/qdeclarativevaluetype_p.h>
+
#include "../../../shared/util.h"
class tst_QDeclarativePathView : public QObject
@@ -69,6 +72,11 @@ private slots:
void path();
void pathMoved();
void resetModel();
+ void propertyChanges();
+ void pathChanges();
+ void componentChanges();
+ void modelChanges();
+
private:
QDeclarativeView *createView();
@@ -120,7 +128,7 @@ public:
setRoleNames(roles);
}
- int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); }
+ int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); }
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const {
QVariant rv;
if (role == Name)
@@ -465,6 +473,149 @@ void tst_QDeclarativePathView::resetModel()
}
}
+void tst_QDeclarativePathView::propertyChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView");
+ QVERIFY(pathView);
+
+ QSignalSpy snapPositionSpy(pathView, SIGNAL(snapPositionChanged()));
+ QSignalSpy dragMarginSpy(pathView, SIGNAL(dragMarginChanged()));
+
+ QCOMPARE(pathView->snapPosition(), 0.1);
+ QCOMPARE(pathView->dragMargin(), 5.0);
+
+ pathView->setSnapPosition(0.4);
+ pathView->setDragMargin(20.0);
+
+ QCOMPARE(pathView->snapPosition(), 0.4);
+ QCOMPARE(pathView->dragMargin(), 20.0);
+
+ QCOMPARE(snapPositionSpy.count(), 1);
+ QCOMPARE(dragMarginSpy.count(), 1);
+
+ pathView->setSnapPosition(0.4);
+ pathView->setDragMargin(20.0);
+
+ QCOMPARE(snapPositionSpy.count(), 1);
+ QCOMPARE(dragMarginSpy.count(), 1);
+ delete canvas;
+}
+
+void tst_QDeclarativePathView::pathChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView");
+ QVERIFY(pathView);
+
+ QDeclarativePath *path = canvas->rootObject()->findChild<QDeclarativePath*>("path");
+ QVERIFY(path);
+
+ QSignalSpy startXSpy(path, SIGNAL(startXChanged()));
+ QSignalSpy startYSpy(path, SIGNAL(startYChanged()));
+
+ QCOMPARE(path->startX(), 220.0);
+ QCOMPARE(path->startY(), 200.0);
+
+ path->setStartX(240.0);
+ path->setStartY(220.0);
+
+ QCOMPARE(path->startX(), 240.0);
+ QCOMPARE(path->startY(), 220.0);
+
+ QCOMPARE(startXSpy.count(),1);
+ QCOMPARE(startYSpy.count(),1);
+
+ path->setStartX(240);
+ path->setStartY(220);
+
+ QCOMPARE(startXSpy.count(),1);
+ QCOMPARE(startYSpy.count(),1);
+
+ QDeclarativePath *alternatePath = canvas->rootObject()->findChild<QDeclarativePath*>("alternatePath");
+ QVERIFY(alternatePath);
+
+ QSignalSpy pathSpy(pathView, SIGNAL(pathChanged()));
+
+ QCOMPARE(pathView->path(), path);
+
+ pathView->setPath(alternatePath);
+ QCOMPARE(pathView->path(), alternatePath);
+ QCOMPARE(pathSpy.count(),1);
+
+ pathView->setPath(alternatePath);
+ QCOMPARE(pathSpy.count(),1);
+
+ QDeclarativePathAttribute *pathAttribute = canvas->rootObject()->findChild<QDeclarativePathAttribute*>("pathAttribute");
+ QVERIFY(pathAttribute);
+
+ QSignalSpy nameSpy(pathAttribute, SIGNAL(nameChanged()));
+ QCOMPARE(pathAttribute->name(), QString("opacity"));
+
+ pathAttribute->setName("scale");
+ QCOMPARE(pathAttribute->name(), QString("scale"));
+ QCOMPARE(nameSpy.count(),1);
+
+ pathAttribute->setName("scale");
+ QCOMPARE(nameSpy.count(),1);
+ delete canvas;
+}
+
+void tst_QDeclarativePathView::componentChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView");
+ QVERIFY(pathView);
+
+ QDeclarativeComponent delegateComponent(canvas->engine());
+ delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile(""));
+
+ QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged()));
+
+ pathView->setDelegate(&delegateComponent);
+ QCOMPARE(pathView->delegate(), &delegateComponent);
+ QCOMPARE(delegateSpy.count(),1);
+
+ pathView->setDelegate(&delegateComponent);
+ QCOMPARE(delegateSpy.count(),1);
+ delete canvas;
+}
+
+void tst_QDeclarativePathView::modelChanges()
+{
+ QDeclarativeView *canvas = createView();
+ QVERIFY(canvas);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+
+ QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView");
+ QVERIFY(pathView);
+
+ QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel");
+ QVERIFY(alternateModel);
+ QVariant modelVariant = QVariant::fromValue(alternateModel);
+ QSignalSpy modelSpy(pathView, SIGNAL(modelChanged()));
+
+ pathView->setModel(modelVariant);
+ QCOMPARE(pathView->model(), modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ pathView->setModel(modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ pathView->setModel(QVariant());
+ QCOMPARE(modelSpy.count(),2);
+
+ delete canvas;
+}
QDeclarativeView *tst_QDeclarativePathView::createView()
{
diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
index 3a8a892..d23d74c 100644
--- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
+++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
@@ -365,7 +365,7 @@ void tst_QDeclarativePositioners::test_grid_animated()
}
void tst_QDeclarativePositioners::test_propertychanges()
{
- QDeclarativeView *canvas = createView("data/propertychanges.qml");
+ QDeclarativeView *canvas = createView(SRCDIR "/data/propertychanges.qml");
QDeclarativeGrid *grid = qobject_cast<QDeclarativeGrid*>(canvas->rootObject());
QDeclarativeTransition *rowTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("rowTransition");
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml
new file mode 100644
index 0000000..1dfb3e1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+QtObject {
+ property int a: 10
+}
+
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml
new file mode 100644
index 0000000..8085db2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+
+QtObject {
+ property TestType test
+
+ test: TestType {
+ property int b: 19
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
index 22e50cc..af1e1b6 100644
--- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
+++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
@@ -3,3 +3,5 @@ contains(QT_CONFIG,declarative): QT += declarative
macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeproperty.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
index 0333d98..9b8a643 100644
--- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
+++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
@@ -46,6 +46,14 @@
#include <private/qguard_p.h>
#include <private/qdeclarativebinding_p.h>
#include <QtGui/QLineEdit>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename));
+}
class MyQmlObject : public QObject
{
@@ -181,6 +189,7 @@ class PropertyObject : public QObject
Q_PROPERTY(QUrl url READ url WRITE setUrl);
Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty);
Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
+ Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject);
Q_CLASSINFO("DefaultProperty", "defaultProperty");
public:
@@ -202,6 +211,7 @@ public:
int propertyWithNotify() const { return m_propertyWithNotify; }
void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); }
+ MyQmlObject *qmlObject() { return &m_qmlObject; }
signals:
void clicked();
void oddlyNamedNotifySignal();
@@ -211,6 +221,7 @@ private:
QRect m_rect;
QUrl m_url;
int m_propertyWithNotify;
+ MyQmlObject m_qmlObject;
};
QML_DECLARE_TYPE(PropertyObject);
@@ -953,6 +964,32 @@ void tst_qdeclarativeproperty::read()
QCOMPARE(p.read(), QVariant());
}
+ // Object property
+ {
+ PropertyObject o;
+ QDeclarativeProperty p(&o, "qmlObject");
+ QCOMPARE(p.propertyTypeCategory(), QDeclarativeProperty::Object);
+ QCOMPARE(p.propertyType(), qMetaTypeId<MyQmlObject*>());
+ QVariant v = p.read();
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QVERIFY(qvariant_cast<QObject *>(v) == o.qmlObject());
+ }
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("readSynthesizedObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QDeclarativeProperty p(object, "test", &engine);
+
+ QCOMPARE(p.propertyTypeCategory(), QDeclarativeProperty::Object);
+ QVERIFY(p.propertyType() != QMetaType::QObjectStar);
+
+ QVariant v = p.read();
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("a").toInt(), 10);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
+ }
+
// Attached property
{
QDeclarativeComponent component(&engine);
diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
new file mode 100644
index 0000000..e62749a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
@@ -0,0 +1,19 @@
+import Qt 4.6
+
+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 var 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")
+
+ property var 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")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 9ec6872..90afd4e 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -67,12 +67,12 @@ private slots:
void darker();
void tint();
void closestAngle();
- void playSound();
void openUrlExternally();
void md5();
void createComponent();
void createQmlObject();
void consoleLog();
+ void formatting();
private:
QDeclarativeEngine engine;
@@ -279,12 +279,6 @@ void tst_qdeclarativeqt::closestAngle()
delete object;
}
-void tst_qdeclarativeqt::playSound()
-{
- QEXPECT_FAIL("", "How do we test this?", Abort);
- QVERIFY(false);
-}
-
void tst_qdeclarativeqt::openUrlExternally()
{
QEXPECT_FAIL("", "How do we test this?", Abort);
@@ -364,6 +358,34 @@ void tst_qdeclarativeqt::consoleLog()
delete object;
}
+void tst_qdeclarativeqt::formatting()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("formatting.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QDate date1(2008,12,24);
+ QCOMPARE(object->property("date1").toDate(), date1);
+ QCOMPARE(object->property("test1").toString(), date1.toString(Qt::DefaultLocaleShortDate));
+ QCOMPARE(object->property("test2").toString(), date1.toString(Qt::DefaultLocaleLongDate));
+ QCOMPARE(object->property("test3").toString(), date1.toString("ddd MMMM d yy"));
+
+ QTime time1(14,15,38,200);
+ QCOMPARE(object->property("time1").toTime(), time1);
+ QCOMPARE(object->property("test4").toString(), time1.toString(Qt::DefaultLocaleShortDate));
+ QCOMPARE(object->property("test5").toString(), time1.toString(Qt::DefaultLocaleLongDate));
+ QCOMPARE(object->property("test6").toString(), time1.toString("H:m:s a"));
+ QCOMPARE(object->property("test7").toString(), time1.toString("hh:mm:ss.zzz"));
+
+ QDateTime dateTime1(QDate(1978,03,04),QTime(9,13,54));
+ QCOMPARE(object->property("dateTime1").toDateTime(),dateTime1);
+ QCOMPARE(object->property("test8").toString(), dateTime1.toString(Qt::DefaultLocaleShortDate));
+ QCOMPARE(object->property("test9").toString(), dateTime1.toString(Qt::DefaultLocaleLongDate));
+ QCOMPARE(object->property("test10").toString(), dateTime1.toString("M/d/yy H:m:s a"));
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeqt)
#include "tst_qdeclarativeqt.moc"
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index b677fec..b1935df 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -663,15 +663,17 @@ void tst_qdeclarativetextedit::delegateLoading()
QVERIFY(delegate);
view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
view->show();
+ QTRY_VERIFY(view->status()==QDeclarativeView::Error);
view->setFocus();
QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
view->show();
+ QTRY_VERIFY(view->status()==QDeclarativeView::Error);
view->setFocus();
QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
- //ErrorB should get a component which is ready but component.create() returns null
+ //A test should be added here with a component which is ready but component.create() returns null
//Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate
- //###This could be a case of overzealous defensive programming
+ //###This was only needed for code coverage, and could be a case of overzealous defensive programming
//delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateErrorB");
//QVERIFY(!delegate);
}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml
index 026ae83..0897847 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml
@@ -3,6 +3,6 @@ import Test 1.0
MyTypeObject {
property int value: 13;
- rect.x: MyOffsetValueInterceptor {}
+ MyOffsetValueInterceptor on rect.x {}
rect.x: value
}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml
index d4d4391..717f350 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml
@@ -1,5 +1,5 @@
import Test 1.0
MyTypeObject {
- rect.x: MyConstantValueSource {}
+ MyConstantValueSource on rect.x {}
}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index 69646b9..8732215 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -502,10 +502,9 @@ void tst_qdeclarativevaluetypes::valueInterceptors()
QDeclarativeComponent component(&engine, TEST_FILE("valueInterceptors.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
checkNoErrors(component);
- QEXPECT_FAIL("", "QT-2920", Abort);
QVERIFY(object != 0);
- QCOMPARE(object->rect().x(), 26);
+ QCOMPARE(object->rect().x(), 13);
object->setProperty("value", 99);
diff --git a/tests/auto/declarative/qdeclarativewebview/data/basic.qml b/tests/auto/declarative/qdeclarativewebview/data/basic.qml
index 5394837..f0b41ef 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/basic.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/basic.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
url: "basic.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/elements.qml b/tests/auto/declarative/qdeclarativewebview/data/elements.qml
index 7c030e6..16e5788 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/elements.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/elements.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
url: "elements.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/forward.png b/tests/auto/declarative/qdeclarativewebview/data/forward.png
new file mode 100644
index 0000000..a82533e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativewebview/data/forward.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml
index 07eee88..0e92e0e 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
url: "javaScript.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml
index 1460f30..f827238 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
url: "does-not-exist.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml
index 0bc8263..4d9df43 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml
@@ -1,6 +1,7 @@
// Demonstrates opening new WebViews from HTML
import Qt 4.6
+import org.webkit 1.0
Grid {
columns: 3
diff --git a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml
index 3dd4e51..0770acf 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
Item {
width: 240
@@ -30,4 +31,4 @@ Item {
pressGrabTime: 200
}
}
-} \ No newline at end of file
+}
diff --git a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml
index 063b5a8..9e17597 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
html: "<p>This is a <b>string</b> set on the WebView"
diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
index 6af0a60..20173c6 100644
--- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
+++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
@@ -3,8 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative
contains(QT_CONFIG,webkit): QT += webkit
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativewebview.cpp testtypes.cpp
-HEADERS += testtypes.h
+SOURCES += tst_qdeclarativewebview.cpp
# Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativewebview/testtypes.cpp b/tests/auto/declarative/qdeclarativewebview/testtypes.cpp
deleted file mode 100644
index 7efc214..0000000
--- a/tests/auto/declarative/qdeclarativewebview/testtypes.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "testtypes.h"
-
-void MyWebView::drawContents(QPainter *p, const QRect &r)
-{
- pp += r.width()*r.height();
- QDeclarativeWebView::drawContents(p,r);
-}
-
-void registerTypes()
-{
- QML_REGISTER_TYPE(Test,1,0,MyWebView,MyWebView);
-}
diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
index 6d16056..b63e14b 100644
--- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
+++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
@@ -43,15 +43,12 @@
#include "../../../shared/util.h"
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
-#include <private/qdeclarativewebview_p.h>
-#include <private/qdeclarativewebview_p_p.h>
#include <private/qdeclarativepositioners_p.h>
#include <QtWebKit/qwebpage.h>
#include <QtWebKit/qwebframe.h>
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
#include <QtGui/qpainter.h>
-#include "testtypes.h"
class tst_qdeclarativewebview : public QObject
{
@@ -70,7 +67,7 @@ private slots:
void setHtml();
void javaScript();
void cleanupTestCase();
- void pixelCache();
+ //void pixelCache();
void newWindowParent();
void newWindowComponent();
void renderingEnabled();
@@ -89,7 +86,6 @@ private:
void tst_qdeclarativewebview::initTestCase()
{
- registerTypes();
}
static QString strippedHtml(QString html)
@@ -148,81 +144,82 @@ void tst_qdeclarativewebview::basicProperties()
checkNoErrors(component);
QWebSettings::enablePersistentStorage(tmpDir());
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
- QCOMPARE(wv->title(),QString("Basic"));
- QTRY_COMPARE(wv->icon().width(), 48);
- QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png"));
- QCOMPARE(wv->statusText(),QString("status here"));
- QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html()));
- QCOMPARE(wv->width(), 123.0);
- QCOMPARE(wv->preferredWidth(), 0);
- QCOMPARE(wv->preferredHeight(), 0);
- QCOMPARE(wv->zoomFactor(), 1.0);
- QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
- QCOMPARE(wv->status(), QDeclarativeWebView::Ready);
- QVERIFY(wv->reloadAction());
- QVERIFY(wv->reloadAction()->isEnabled());
- QVERIFY(wv->backAction());
- QVERIFY(!wv->backAction()->isEnabled());
- QVERIFY(wv->forwardAction());
- QVERIFY(!wv->forwardAction()->isEnabled());
- QVERIFY(wv->stopAction());
- QVERIFY(!wv->stopAction()->isEnabled());
-
- wv->setPixelCacheSize(0); // mainly testing that it doesn't crash or anything!
- QCOMPARE(wv->pixelCacheSize(),0);
- wv->reloadAction()->trigger();
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ QCOMPARE(wv->property("title").toString(),QString("Basic"));
+ QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 48);
+ QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png"));
+ QCOMPARE(wv->property("statusText").toString(),QString("status here"));
+ QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString()));
+ QCOMPARE(wv->property("width").toDouble(), 123.0);
+ QCOMPARE(wv->property("preferredWidth").toInt(), 0);
+ QCOMPARE(wv->property("preferredHeight").toInt(), 0);
+ QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0);
+ QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
+ QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/);
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload")));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("back")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("back"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("forward")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("forward"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("stop")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("stop"))->isEnabled());
+
+ wv->setProperty("pixelCacheSize", 0); // mainly testing that it doesn't crash or anything!
+ QCOMPARE(wv->property("pixelCacheSize").toInt(),0);
+ qvariant_cast<QAction*>(wv->property("reload"))->trigger();
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
}
void tst_qdeclarativewebview::settings()
{
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
checkNoErrors(component);
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
- QDeclarativeWebSettings *s = wv->settingsObject();
+ QObject *s = QDeclarativeProperty(wv,"settings").object();
+ QVERIFY(s != 0);
// merely tests that setting gets stored (in QWebSettings)
// behavioural tests are in WebKit.
for (int b=0; b<=1; ++b) {
bool on = !!b;
- s->setAutoLoadImages(on);
- s->setDeveloperExtrasEnabled(on);
- s->setJavaEnabled(on);
- s->setJavascriptCanAccessClipboard(on);
- s->setJavascriptCanOpenWindows(on);
- s->setJavascriptEnabled(on);
- s->setLinksIncludedInFocusChain(on);
- s->setLocalContentCanAccessRemoteUrls(on);
- s->setLocalStorageDatabaseEnabled(on);
- s->setOfflineStorageDatabaseEnabled(on);
- s->setOfflineWebApplicationCacheEnabled(on);
- s->setPluginsEnabled(on);
- s->setPrintElementBackgrounds(on);
- s->setPrivateBrowsingEnabled(on);
- s->setZoomTextOnly(on);
-
- QVERIFY(s->autoLoadImages() == on);
- QVERIFY(s->developerExtrasEnabled() == on);
- QVERIFY(s->javaEnabled() == on);
- QVERIFY(s->javascriptCanAccessClipboard() == on);
- QVERIFY(s->javascriptCanOpenWindows() == on);
- QVERIFY(s->javascriptEnabled() == on);
- QVERIFY(s->linksIncludedInFocusChain() == on);
- QVERIFY(s->localContentCanAccessRemoteUrls() == on);
- QVERIFY(s->localStorageDatabaseEnabled() == on);
- QVERIFY(s->offlineStorageDatabaseEnabled() == on);
- QVERIFY(s->offlineWebApplicationCacheEnabled() == on);
- QVERIFY(s->pluginsEnabled() == on);
- QVERIFY(s->printElementBackgrounds() == on);
- QVERIFY(s->privateBrowsingEnabled() == on);
- QVERIFY(s->zoomTextOnly() == on);
+ s->setProperty("autoLoadImages", on);
+ s->setProperty("developerExtrasEnabled", on);
+ s->setProperty("javaEnabled", on);
+ s->setProperty("javascriptCanAccessClipboard", on);
+ s->setProperty("javascriptCanOpenWindows", on);
+ s->setProperty("javascriptEnabled", on);
+ s->setProperty("linksIncludedInFocusChain", on);
+ s->setProperty("localContentCanAccessRemoteUrls", on);
+ s->setProperty("localStorageDatabaseEnabled", on);
+ s->setProperty("offlineStorageDatabaseEnabled", on);
+ s->setProperty("offlineWebApplicationCacheEnabled", on);
+ s->setProperty("pluginsEnabled", on);
+ s->setProperty("printElementBackgrounds", on);
+ s->setProperty("privateBrowsingEnabled", on);
+ s->setProperty("zoomTextOnly", on);
+
+ QVERIFY(s->property("autoLoadImages") == on);
+ QVERIFY(s->property("developerExtrasEnabled") == on);
+ QVERIFY(s->property("javaEnabled") == on);
+ QVERIFY(s->property("javascriptCanAccessClipboard") == on);
+ QVERIFY(s->property("javascriptCanOpenWindows") == on);
+ QVERIFY(s->property("javascriptEnabled") == on);
+ QVERIFY(s->property("linksIncludedInFocusChain") == on);
+ QVERIFY(s->property("localContentCanAccessRemoteUrls") == on);
+ QVERIFY(s->property("localStorageDatabaseEnabled") == on);
+ QVERIFY(s->property("offlineStorageDatabaseEnabled") == on);
+ QVERIFY(s->property("offlineWebApplicationCacheEnabled") == on);
+ QVERIFY(s->property("pluginsEnabled") == on);
+ QVERIFY(s->property("printElementBackgrounds") == on);
+ QVERIFY(s->property("privateBrowsingEnabled") == on);
+ QVERIFY(s->property("zoomTextOnly") == on);
QVERIFY(s->property("autoLoadImages") == on);
QVERIFY(s->property("developerExtrasEnabled") == on);
@@ -248,65 +245,65 @@ void tst_qdeclarativewebview::historyNav()
checkNoErrors(component);
QWebSettings::enablePersistentStorage(tmpDir());
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
for (int i=1; i<=2; ++i) {
- QTRY_COMPARE(wv->progress(), 1.0);
- QCOMPARE(wv->title(),QString("Basic"));
- QTRY_COMPARE(wv->icon().width(), 48);
- QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png"));
- QCOMPARE(wv->statusText(),QString("status here"));
- QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html()));
- QCOMPARE(wv->width(), 123.0);
- QCOMPARE(wv->preferredWidth(), 0);
- QCOMPARE(wv->zoomFactor(), 1.0);
- QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
- QCOMPARE(wv->status(), QDeclarativeWebView::Ready);
- QVERIFY(wv->reloadAction());
- QVERIFY(wv->reloadAction()->isEnabled());
- QVERIFY(wv->backAction());
- QVERIFY(!wv->backAction()->isEnabled());
- QVERIFY(wv->forwardAction());
- QVERIFY(!wv->forwardAction()->isEnabled());
- QVERIFY(wv->stopAction());
- QVERIFY(!wv->stopAction()->isEnabled());
-
- wv->reloadAction()->trigger();
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ QCOMPARE(wv->property("title").toString(),QString("Basic"));
+ QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 48);
+ QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png"));
+ QCOMPARE(wv->property("statusText").toString(),QString("status here"));
+ QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString()));
+ QCOMPARE(wv->property("width").toDouble(), 123.0);
+ QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0);
+ QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0);
+ QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
+ QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/);
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload")));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("back")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("back"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("forward")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("forward"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("stop")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("stop"))->isEnabled());
+
+ qvariant_cast<QAction*>(wv->property("reload"))->trigger();
}
- wv->setUrl(QUrl::fromLocalFile(SRCDIR "/data/forward.html"));
- QTRY_COMPARE(wv->progress(), 1.0);
- QCOMPARE(wv->title(),QString("Forward"));
- QTRY_COMPARE(wv->icon().width(), 32);
- QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/forward.png"));
- QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->html()));
- QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/forward.html"));
- QCOMPARE(wv->status(), QDeclarativeWebView::Ready);
- QCOMPARE(wv->statusText(),QString(""));
- QVERIFY(wv->reloadAction());
- QVERIFY(wv->reloadAction()->isEnabled());
- QVERIFY(wv->backAction());
- QVERIFY(wv->backAction()->isEnabled());
- QVERIFY(wv->forwardAction());
- QVERIFY(!wv->forwardAction()->isEnabled());
- QVERIFY(wv->stopAction());
- QVERIFY(!wv->stopAction()->isEnabled());
-
- wv->backAction()->trigger();
-
- QTRY_COMPARE(wv->progress(), 1.0);
- QCOMPARE(wv->title(),QString("Basic"));
- QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html()));
- QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
- QCOMPARE(wv->status(), QDeclarativeWebView::Ready);
- QVERIFY(wv->reloadAction());
- QVERIFY(wv->reloadAction()->isEnabled());
- QVERIFY(wv->backAction());
- QVERIFY(!wv->backAction()->isEnabled());
- QVERIFY(wv->forwardAction());
- QVERIFY(wv->forwardAction()->isEnabled());
- QVERIFY(wv->stopAction());
- QVERIFY(!wv->stopAction()->isEnabled());
+ wv->setProperty("url", QUrl::fromLocalFile(SRCDIR "/data/forward.html"));
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ QCOMPARE(wv->property("title").toString(),QString("Forward"));
+ QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 32);
+ QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")),QPixmap(SRCDIR "/data/forward.png"));
+ QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->property("html").toString()));
+ QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/forward.html"));
+ QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/);
+ QCOMPARE(wv->property("statusText").toString(),QString(""));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload")));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("back")));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("back"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("forward")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("forward"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("stop")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("stop"))->isEnabled());
+
+ qvariant_cast<QAction*>(wv->property("back"))->trigger();
+
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ QCOMPARE(wv->property("title").toString(),QString("Basic"));
+ QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString()));
+ QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
+ QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/);
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload")));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("reload"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("back")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("back"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("forward")));
+ QVERIFY(qvariant_cast<QAction*>(wv->property("forward"))->isEnabled());
+ QVERIFY(qvariant_cast<QAction*>(wv->property("stop")));
+ QVERIFY(!qvariant_cast<QAction*>(wv->property("stop"))->isEnabled());
}
void tst_qdeclarativewebview::multipleWindows()
@@ -328,16 +325,16 @@ void tst_qdeclarativewebview::loadError()
checkNoErrors(component);
QWebSettings::enablePersistentStorage(tmpDir());
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
for (int i=1; i<=2; ++i) {
- QTRY_COMPARE(wv->progress(), 1.0);
- QCOMPARE(wv->title(),QString(""));
- QCOMPARE(wv->statusText(),QString("")); // HTML 'status bar' text, not error message
- QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/does-not-exist.html")); // Unlike QWebPage, which loses url
- QCOMPARE(wv->status(), QDeclarativeWebView::Error);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ QCOMPARE(wv->property("title").toString(),QString(""));
+ QCOMPARE(wv->property("statusText").toString(),QString("")); // HTML 'status bar' text, not error message
+ QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/does-not-exist.html")); // Unlike QWebPage, which loses url
+ QCOMPARE(wv->property("status").toInt(), 3 /*QDeclarativeWebView::Error*/);
- wv->reloadAction()->trigger();
+ qvariant_cast<QAction*>(wv->property("reload"))->trigger();
}
}
@@ -345,12 +342,12 @@ void tst_qdeclarativewebview::setHtml()
{
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/sethtml.qml"));
checkNoErrors(component);
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
- QCOMPARE(wv->html(),QString("<html><head></head><body><p>This is a <b>string</b> set on the WebView</p></body></html>"));
+ QCOMPARE(wv->property("html").toString(),QString("<html><head></head><body><p>This is a <b>string</b> set on the WebView</p></body></html>"));
QSignalSpy spy(wv, SIGNAL(htmlChanged()));
- wv->setHtml(QString("<html><head><title>Basic</title></head><body><p>text</p></body></html>"));
+ wv->setProperty("html", QString("<html><head><title>Basic</title></head><body><p>text</p></body></html>"));
QCOMPARE(spy.count(),1);
}
@@ -358,81 +355,91 @@ void tst_qdeclarativewebview::elementAreaAt()
{
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/elements.qml"));
checkNoErrors(component);
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ /* not now it's a plugin...
QCOMPARE(wv->elementAreaAt(40,30,100,100),QRect(1,1,75,54)); // Area A in data/elements.html
QCOMPARE(wv->elementAreaAt(130,30,200,100),QRect(78,3,110,50)); // Area B
QCOMPARE(wv->elementAreaAt(40,30,400,400),QRect(0,0,310,100)); // Whole view
QCOMPARE(wv->elementAreaAt(130,30,280,280),QRect(76,1,223,54)); // Area BC
QCOMPARE(wv->elementAreaAt(130,30,400,400),QRect(0,0,310,100)); // Whole view
+ */
}
void tst_qdeclarativewebview::javaScript()
{
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/javaScript.qml"));
checkNoErrors(component);
- QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create());
+ QObject *wv = component.create();
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ /* not now it's a plugin...
QCOMPARE(wv->evaluateJavaScript("123").toInt(), 123);
QCOMPARE(wv->evaluateJavaScript("window.status").toString(), QString("status here"));
QCOMPARE(wv->evaluateJavaScript("window.myjsname.qmlprop").toString(), QString("qmlvalue"));
+ */
}
+/*
+Cannot be done now that webkit is a plugin
+
void tst_qdeclarativewebview::pixelCache()
{
+
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/pixelCache.qml"));
checkNoErrors(component);
MyWebView *wv = qobject_cast<MyWebView*>(component.create());
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress"), 1.0);
QPixmap pm(150,150);
QPainter p(&pm);
wv->paint(&p,0,0);
const int expected = 120*(150+128); // 120 = width of HTML page, 150=pixmap height, 128=cache extra area
- QCOMPARE(wv->pixelsPainted(), expected);
+ QCOMPARE(wv->property("pixelsPainted"), expected);
wv->paint(&p,0,0);
- QCOMPARE(wv->pixelsPainted(), expected); // nothing new needed to be painted
- wv->setPixelCacheSize(0); // clears the cache
+ QCOMPARE(wv->property("pixelsPainted"), expected); // nothing new needed to be painted
+ wv->setProperty("pixelCacheSize", 0); // clears the cache
wv->paint(&p,0,0);
- QCOMPARE(wv->pixelsPainted(), expected*2); // everything needed to be painted
+ QCOMPARE(wv->property("pixelsPainted"), expected*2); // everything needed to be painted
// Note that painted things always go into the cache (even if they don't "fit"),
// just that they will be removed if anything else needs to be painted.
- wv->setPixelCacheSize(expected); // won't clear the cache
+ wv->setProperty("pixelCacheSize", expected); // won't clear the cache
wv->paint(&p,0,0);
- QCOMPARE(wv->pixelsPainted(), expected*2); // still there
- wv->setPixelCacheSize(expected-1); // too small - will clear the cache
+ QCOMPARE(wv->property("pixelsPainted"), expected*2); // still there
+ wv->setProperty("pixelCacheSize", expected-1); // too small - will clear the cache
wv->paint(&p,0,0);
- QCOMPARE(wv->pixelsPainted(), expected*3); // repainted
+ QCOMPARE(wv->property("pixelsPainted"), expected*3); // repainted
}
+*/
void tst_qdeclarativewebview::newWindowParent()
{
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
checkNoErrors(component);
QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create());
- QDeclarativeWebView *wv = rootItem->findChild<QDeclarativeWebView*>("webView");
+ QObject *wv = rootItem->findChild<QObject*>("webView");
QVERIFY(rootItem != 0);
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
QDeclarativeItem* oldWindowParent = rootItem->findChild<QDeclarativeItem*>("oldWindowParent");
- QCOMPARE(wv->newWindowParent(), oldWindowParent);
+ QCOMPARE(qvariant_cast<QDeclarativeItem*>(wv->property("newWindowParent")), oldWindowParent);
QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged()));
QDeclarativeItem* newWindowParent = rootItem->findChild<QDeclarativeItem*>("newWindowParent");
- wv->setNewWindowParent(newWindowParent);
+ wv->setProperty("newWindowParent", QVariant::fromValue(newWindowParent));
+ QVERIFY(newWindowParent);
QVERIFY(oldWindowParent);
QVERIFY(oldWindowParent->childItems().count() == 0);
- QCOMPARE(wv->newWindowParent(), newWindowParent);
+ QCOMPARE(wv->property("newWindowParent"), QVariant::fromValue(newWindowParent));
QCOMPARE(newWindowParentSpy.count(),1);
- wv->setNewWindowParent(newWindowParent);
+ wv->setProperty("newWindowParent", QVariant::fromValue(newWindowParent));
QCOMPARE(newWindowParentSpy.count(),1);
- wv->setNewWindowParent(0);
+ wv->setProperty("newWindowParent", QVariant::fromValue((QDeclarativeItem*)0));
QCOMPARE(newWindowParentSpy.count(),2);
}
@@ -441,23 +448,23 @@ void tst_qdeclarativewebview::newWindowComponent()
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
checkNoErrors(component);
QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create());
- QDeclarativeWebView *wv = rootItem->findChild<QDeclarativeWebView*>("webView");
+ QObject *wv = rootItem->findChild<QObject*>("webView");
QVERIFY(rootItem != 0);
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
QDeclarativeComponent substituteComponent(&engine);
substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile(""));
QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged()));
- wv->setNewWindowComponent(&substituteComponent);
- QCOMPARE(wv->newWindowComponent(), &substituteComponent);
+ wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent));
+ QCOMPARE(wv->property("newWindowComponent"), QVariant::fromValue(&substituteComponent));
QCOMPARE(newWindowComponentSpy.count(),1);
- wv->setNewWindowComponent(&substituteComponent);
+ wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent));
QCOMPARE(newWindowComponentSpy.count(),1);
- wv->setNewWindowComponent(0);
+ wv->setProperty("newWindowComponent", QVariant::fromValue((QDeclarativeComponent*)0));
QCOMPARE(newWindowComponentSpy.count(),2);
}
@@ -466,22 +473,22 @@ void tst_qdeclarativewebview::renderingEnabled()
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
checkNoErrors(component);
QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create());
- QDeclarativeWebView *wv = rootItem->findChild<QDeclarativeWebView*>("webView");
+ QObject *wv = rootItem->findChild<QObject*>("webView");
QVERIFY(rootItem != 0);
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
- QVERIFY(wv->renderingEnabled());
+ QVERIFY(wv->property("renderingEnabled").toBool());
QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged()));
- wv->setRenderingEnabled(false);
- QVERIFY(!wv->renderingEnabled());
+ wv->setProperty("renderingEnabled", false);
+ QVERIFY(!wv->property("renderingEnabled").toBool());
QCOMPARE(renderingEnabledSpy.count(),1);
- wv->setRenderingEnabled(false);
+ wv->setProperty("renderingEnabled", false);
QCOMPARE(renderingEnabledSpy.count(),1);
- wv->setRenderingEnabled(true);
+ wv->setProperty("renderingEnabled", true);
QCOMPARE(renderingEnabledSpy.count(),2);
}
@@ -490,21 +497,21 @@ void tst_qdeclarativewebview::pressGrabTime()
QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
checkNoErrors(component);
QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create());
- QDeclarativeWebView *wv = rootItem->findChild<QDeclarativeWebView*>("webView");
+ QObject *wv = rootItem->findChild<QObject*>("webView");
QVERIFY(rootItem != 0);
QVERIFY(wv != 0);
- QTRY_COMPARE(wv->progress(), 1.0);
- QCOMPARE(wv->pressGrabTime(), 200);
+ QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
+ QCOMPARE(wv->property("pressGrabTime").toInt(), 200);
QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged()));
- wv->setPressGrabTime(100);
- QCOMPARE(wv->pressGrabTime(), 100);
+ wv->setProperty("pressGrabTime", 100);
+ QCOMPARE(wv->property("pressGrabTime").toInt(), 100);
QCOMPARE(pressGrabTimeSpy.count(),1);
- wv->setPressGrabTime(100);
+ wv->setProperty("pressGrabTime", 100);
QCOMPARE(pressGrabTimeSpy.count(),1);
- wv->setPressGrabTime(0);
+ wv->setProperty("pressGrabTime", 0);
QCOMPARE(pressGrabTimeSpy.count(),2);
}
diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml
new file mode 100644
index 0000000..be94e00
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Item {
+ property alias model: model
+
+ WorkerListModel { id: model }
+
+ function workerModifyModel(cmd) { worker.sendMessage({'command': cmd, 'model': model}) }
+
+ WorkerScript {
+ id: worker
+ source: "script.js"
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js
new file mode 100644
index 0000000..8ee62b4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js
@@ -0,0 +1,6 @@
+WorkerScript.onMessage = function(msg) {
+ eval("msg.model." + msg.command)
+ msg.model.sync()
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro b/tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro
new file mode 100644
index 0000000..960dbe1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+QT += script
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativeworkerlistmodel.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp b/tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp
new file mode 100644
index 0000000..11a7447
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtCore/qdebug.h>
+
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativeitem.h>
+
+#include <private/qdeclarativeworkerscript_p.h>
+#include <private/qdeclarativelistmodel_p.h>
+#include "../../../shared/util.h"
+
+
+
+class tst_QDeclarativeWorkerListModel : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QDeclarativeWorkerListModel() {}
+private slots:
+ void clear();
+ void remove();
+ void append();
+ void insert();
+ void get();
+ void set();
+
+private:
+ QByteArray modificationWarning() const {
+ QString file = QUrl::fromLocalFile(SRCDIR "/data/model.qml").toString();
+ return QString("QML WorkerListModel (" + file + ":6:5) List can only be modified from a WorkerScript").toUtf8();
+ }
+
+ QDeclarativeEngine m_engine;
+};
+
+void tst_QDeclarativeWorkerListModel::clear()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml");
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeWorkerListModel *model = item->property("model").value<QDeclarativeWorkerListModel*>();
+ QVERIFY(model != 0);
+
+ QCOMPARE(model->count(), 0);
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})")));
+ QTRY_COMPARE(model->count(), 1);
+
+ QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData());
+ model->clear();
+ QCOMPARE(model->count(), 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "clear()")));
+ QTRY_COMPARE(model->count(), 0);
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerListModel::remove()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml");
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeWorkerListModel *model = item->property("model").value<QDeclarativeWorkerListModel*>();
+ QVERIFY(model != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})")));
+ QTRY_COMPARE(model->count(), 1);
+
+ QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData());
+ model->remove(0);
+ QCOMPARE(model->count(), 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "remove(0)")));
+ QTRY_COMPARE(model->count(), 0);
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerListModel::append()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml");
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeWorkerListModel *model = item->property("model").value<QDeclarativeWorkerListModel*>();
+ QVERIFY(model != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})")));
+ QTRY_COMPARE(model->count(), 1);
+
+ QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData());
+ model->append(QScriptValue(1));
+ QCOMPARE(model->count(), 1);
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerListModel::insert()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml");
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeWorkerListModel *model = item->property("model").value<QDeclarativeWorkerListModel*>();
+ QVERIFY(model != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "insert(0, {'name': 'A'})")));
+ QTRY_COMPARE(model->count(), 1);
+
+ QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData());
+ model->insert(0, QScriptValue(1));
+ QCOMPARE(model->count(), 1);
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerListModel::get()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml");
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeWorkerListModel *model = item->property("model").value<QDeclarativeWorkerListModel*>();
+ QVERIFY(model != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})")));
+ QTRY_COMPARE(model->count(), 1);
+ QCOMPARE(model->get(0).property("name").toString(), QString("A"));
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerListModel::set()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml");
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeWorkerListModel *model = item->property("model").value<QDeclarativeWorkerListModel*>();
+ QVERIFY(model != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})")));
+ QTRY_COMPARE(model->count(), 1);
+
+ QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData());
+ model->set(0, QScriptValue(1));
+
+ QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "set(0, {'name': 'Z'})")));
+ QTRY_COMPARE(model->get(0).property("name").toString(), QString("Z"));
+
+ qApp->processEvents();
+}
+
+QTEST_MAIN(tst_QDeclarativeWorkerListModel)
+
+#include "tst_qdeclarativeworkerlistmodel.moc"
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js
new file mode 100644
index 0000000..09199de
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js
@@ -0,0 +1,5 @@
+WorkerScript.onMessage = function(msg) {
+ WorkerScript.sendMessage(msg)
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
new file mode 100644
index 0000000..1fce155
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+WorkerScript {
+ id: worker
+ source: "script.js"
+
+ property var response
+
+ signal done()
+
+ function testSend(value) {
+ worker.sendMessage(value)
+ }
+
+ function compareLiteralResponse(expected) {
+ var e = eval('(' + expected + ')')
+ return worker.response == e
+ }
+
+ onMessage: {
+ worker.response = messageObject
+ worker.done()
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
new file mode 100644
index 0000000..0543ff6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+QT += script
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativeworkerscript.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
new file mode 100644
index 0000000..27ecef4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+#include <QtScript/qscriptengine.h>
+
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativeitem.h>
+
+#include <private/qdeclarativeworkerscript_p.h>
+#include <private/qdeclarativeengine_p.h>
+#include "../../../shared/util.h"
+
+Q_DECLARE_METATYPE(QScriptValue)
+
+class tst_QDeclarativeWorkerScript : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QDeclarativeWorkerScript() {}
+private slots:
+ void source();
+ void source_data();
+ void messaging();
+ void messaging_data();
+ void messaging_sendQObjectList();
+ void messaging_sendJsObject();
+
+private:
+ void waitForEchoMessage(QDeclarativeWorkerScript *worker) {
+ QEventLoop loop;
+ QVERIFY(connect(worker, SIGNAL(done()), &loop, SLOT(quit())));
+ QTimer timer;
+ timer.setSingleShot(true);
+ connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.start(10000);
+ loop.exec();
+ QVERIFY(timer.isActive());
+ }
+
+ QDeclarativeEngine m_engine;
+};
+
+void tst_QDeclarativeWorkerScript::source()
+{
+ QFETCH(QUrl, source);
+ QFETCH(bool, valid);
+
+ if (!valid) {
+ QByteArray w = "WorkerScript: Cannot find source file \"" + source.toString().toUtf8() + "\"";
+ QTest::ignoreMessage(QtWarningMsg, w.constData());
+ }
+
+ QDeclarativeComponent component(&m_engine);
+ component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl());
+
+ QDeclarativeWorkerScript *item = qobject_cast<QDeclarativeWorkerScript*>(component.create());
+ QVERIFY(item != 0);
+
+ QCOMPARE(item->source(), source);
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerScript::source_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<bool>("valid");
+
+ QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/worker.qml") << true;
+ QTest::newRow("invalid") << QUrl::fromLocalFile("asdjfk.js") << false;
+}
+
+void tst_QDeclarativeWorkerScript::messaging()
+{
+ QFETCH(QVariant, value);
+
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+ waitForEchoMessage(worker);
+
+ const QMetaObject *mo = worker->metaObject();
+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value);
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerScript::messaging_data()
+{
+ QTest::addColumn<QVariant>("value");
+
+ QTest::newRow("invalid") << QVariant();
+ QTest::newRow("bool") << qVariantFromValue(true);
+ QTest::newRow("int") << qVariantFromValue(1001);
+ QTest::newRow("real") << qVariantFromValue(10334.323);
+ QTest::newRow("string") << qVariantFromValue(QString("More cheeeese, Gromit!"));
+ QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c"));
+}
+
+void tst_QDeclarativeWorkerScript::messaging_sendQObjectList()
+{
+ // Not allowed to send QObjects other than QDeclarativeWorkerListModelAgent
+ // instances. If objects are sent in a list, they will be sent as 'undefined'
+ // js values.
+
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QVariantList objects;
+ for (int i=0; i<3; i++)
+ objects << qVariantFromValue(new QObject(this));
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(objects))));
+ waitForEchoMessage(worker);
+
+ const QMetaObject *mo = worker->metaObject();
+ QVariantList result = mo->property(mo->indexOfProperty("response")).read(worker).value<QVariantList>();
+ QCOMPARE(result, (QVariantList() << QVariant() << QVariant() << QVariant()));
+
+ qApp->processEvents();
+}
+
+void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml");
+ QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QString jsObject = "{'name': 'zyz', 'spell power': 3101, 'haste': 1125}";
+
+ QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(worker));
+ QScriptValue sv = engine->newObject();
+ sv.setProperty("name", "zyz");
+ sv.setProperty("spell power", 3101);
+ sv.setProperty("haste", 1125);
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(sv))));
+ waitForEchoMessage(worker);
+
+ QVariant result = qVariantFromValue(false);
+ QVERIFY(QMetaObject::invokeMethod(worker, "compareLiteralResponse", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, jsObject)));
+ QVERIFY(result.toBool());
+
+ qApp->processEvents();
+}
+
+QTEST_MAIN(tst_QDeclarativeWorkerScript)
+
+#include "tst_qdeclarativeworkerscript.moc"
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index 37d48fa..7dec0ee 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -1168,7 +1168,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html");
- server.serveDirectory("data");
+ server.serveDirectory(SRCDIR "/data");
QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml"));
QObject *object = component.beginCreate(engine.rootContext());
@@ -1187,7 +1187,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html");
- server.serveDirectory("data");
+ server.serveDirectory(SRCDIR "/data");
QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml"));
QObject *object = component.beginCreate(engine.rootContext());
@@ -1206,7 +1206,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html");
- server.serveDirectory("data");
+ server.serveDirectory(SRCDIR "/data");
QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml"));
QObject *object = component.beginCreate(engine.rootContext());
diff --git a/tests/auto/declarative/runall.sh b/tests/auto/declarative/runall.sh
index 39485d3..62e03e3 100755
--- a/tests/auto/declarative/runall.sh
+++ b/tests/auto/declarative/runall.sh
@@ -41,37 +41,60 @@
##
############################################################################/
-Xnest :7 2>/dev/null &
-sleep 1
-trap "kill $!" EXIT
-export DISPLAY=:7
+if [ "$(uname)" = Linux ]
+then
+ Xnest :7 2>/dev/null &
+ sleep 1
+ trap "kill $!" EXIT
+ export DISPLAY=:7
+ export LANG=en_US
+ kwin 2>/dev/null &
+ sleep 1
+fi
-( make -k -j1 install 2>&1;
- for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p')
- do
- $exe
- done
-) |
+function filter
+{
+ exe=$1
+ skip=0
while read line
do
- case "$line" in
- make*Error) echo "$line";;
- make*Stop) echo "$line";;
- make*) ;;
- install*) ;;
- */qmake*) ;;
- */bin/moc*) ;;
- *targ.debug*) ;;
- g++*) ;;
- cd*) ;;
- PASS*) ;;
- QDEBUG*) ;;
- Makefile*) ;;
- Config*) ;;
- Totals*) ;;
- \**) ;;
- ./*) ;;
- *) echo "$line"
- esac
+ if [ $skip != 0 ]
+ then
+ let skip=skip-1
+ else
+ case "$line" in
+ make*Error) echo "$line";;
+ make*Stop) echo "$line";;
+ /*/bin/make*) ;;
+ make*) ;;
+ install*) ;;
+ QDeclarativeDebugServer:*Waiting*) ;;
+ QDeclarativeDebugServer:*Connection*) ;;
+ */qmake*) ;;
+ */bin/moc*) ;;
+ *targ.debug*) ;;
+ g++*) ;;
+ cd*) ;;
+ XFAIL*) skip=1;;
+ SKIP*) skip=1;;
+ PASS*) ;;
+ QDEBUG*) ;;
+ Makefile*) ;;
+ Config*) ;;
+ Totals*) ;;
+ \**) ;;
+ ./*) ;;
+ *tst_*) echo "$line" ;;
+ *) echo "$exe: $line"
+ esac
+ fi
done
+}
+
+make -k -j1 install 2>&1 | filter build
+for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p')
+do
+ echo $exe
+ $exe 2>&1 | filter $exe
+done
diff --git a/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml b/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml
index 74c6844..3c00ee6 100644
--- a/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml
+++ b/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
// The WebView size is determined by the width, height,
// preferredWidth, and preferredHeight properties.
diff --git a/tests/auto/declarative/visual/webview/embedding/nesting.qml b/tests/auto/declarative/visual/webview/embedding/nesting.qml
index 0d76579..5e35306 100644
--- a/tests/auto/declarative/visual/webview/embedding/nesting.qml
+++ b/tests/auto/declarative/visual/webview/embedding/nesting.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
width: 300
diff --git a/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml b/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml
index 78d5cfc..6c01382 100644
--- a/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml
+++ b/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
Column {
WebView {
diff --git a/tests/auto/declarative/visual/webview/javascript/windowObjects.qml b/tests/auto/declarative/visual/webview/javascript/windowObjects.qml
index a41de9a..8c52aff 100644
--- a/tests/auto/declarative/visual/webview/javascript/windowObjects.qml
+++ b/tests/auto/declarative/visual/webview/javascript/windowObjects.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
Column {
WebView {
diff --git a/tests/auto/declarative/visual/webview/settings/fontFamily.qml b/tests/auto/declarative/visual/webview/settings/fontFamily.qml
index 2bb2a53..f547b0e 100644
--- a/tests/auto/declarative/visual/webview/settings/fontFamily.qml
+++ b/tests/auto/declarative/visual/webview/settings/fontFamily.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
id: web
diff --git a/tests/auto/declarative/visual/webview/settings/fontSize.qml b/tests/auto/declarative/visual/webview/settings/fontSize.qml
index b970783..7eaa96b 100644
--- a/tests/auto/declarative/visual/webview/settings/fontSize.qml
+++ b/tests/auto/declarative/visual/webview/settings/fontSize.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
Grid {
columns: 3
diff --git a/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml b/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml
index 72e672d..67f1633 100644
--- a/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml
+++ b/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
Grid {
columns: 2
diff --git a/tests/auto/declarative/visual/webview/settings/setFontFamily.qml b/tests/auto/declarative/visual/webview/settings/setFontFamily.qml
index 26deed8..823469f 100644
--- a/tests/auto/declarative/visual/webview/settings/setFontFamily.qml
+++ b/tests/auto/declarative/visual/webview/settings/setFontFamily.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
url: "test.html"
diff --git a/tests/auto/declarative/visual/webview/zooming/pageWidth.qml b/tests/auto/declarative/visual/webview/zooming/pageWidth.qml
index 86dd7d2..4a876dd 100644
--- a/tests/auto/declarative/visual/webview/zooming/pageWidth.qml
+++ b/tests/auto/declarative/visual/webview/zooming/pageWidth.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
width: 200
diff --git a/tests/auto/declarative/visual/webview/zooming/renderControl.qml b/tests/auto/declarative/visual/webview/zooming/renderControl.qml
index 0c8bb3b..49eb91b 100644
--- a/tests/auto/declarative/visual/webview/zooming/renderControl.qml
+++ b/tests/auto/declarative/visual/webview/zooming/renderControl.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
Rectangle {
width: 200
diff --git a/tests/auto/declarative/visual/webview/zooming/resolution.qml b/tests/auto/declarative/visual/webview/zooming/resolution.qml
index a9d4e3a..8542768 100644
--- a/tests/auto/declarative/visual/webview/zooming/resolution.qml
+++ b/tests/auto/declarative/visual/webview/zooming/resolution.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
width: 200 * zoomFactor
diff --git a/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml b/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml
index 4455b43..c2e9348 100644
--- a/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml
+++ b/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
WebView {
width: 200
diff --git a/tests/auto/declarative/visual/webview/zooming/zooming.qml b/tests/auto/declarative/visual/webview/zooming/zooming.qml
index 0ea9131..9f0b865 100644
--- a/tests/auto/declarative/visual/webview/zooming/zooming.qml
+++ b/tests/auto/declarative/visual/webview/zooming/zooming.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import org.webkit 1.0
// Note that zooming is better done using zoomFactor and careful
// control of rendering to avoid excessive re-rendering during
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 3745767..12c5843 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -271,6 +271,7 @@ void tst_Headers::macros()
if (header.endsWith("_p.h") || header.endsWith("_pch.h")
|| header.contains("global/qconfig-") || header.endsWith("/qconfig.h")
|| header.contains("/src/tools/") || header.contains("/src/plugins/")
+ || header.contains("/src/imports/")
|| header.endsWith("/qiconset.h") || header.endsWith("/qfeatures.h")
|| header.endsWith("qt_windows.h"))
return;
diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro
index aa4cc41..5ceaf34 100644
--- a/tests/benchmarks/declarative/binding/binding.pro
+++ b/tests/benchmarks/declarative/binding/binding.pro
@@ -7,6 +7,9 @@ macx:CONFIG -= app_bundle
SOURCES += tst_binding.cpp testtypes.cpp
HEADERS += testtypes.h
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
symbian* {
data.sources = data/*
data.path = data
diff --git a/tests/benchmarks/declarative/binding/data/idproperty.txt b/tests/benchmarks/declarative/binding/data/idproperty.txt
index 71e3c4e..4e474ba 100644
--- a/tests/benchmarks/declarative/binding/data/idproperty.txt
+++ b/tests/benchmarks/declarative/binding/data/idproperty.txt
@@ -1,7 +1,7 @@
import Test 1.0
MyQmlObject {
- id: MyObject
+ id: myObject
MyQmlObject {
result: ###
diff --git a/tests/benchmarks/declarative/binding/data/objectproperty.txt b/tests/benchmarks/declarative/binding/data/objectproperty.txt
index 63fa74d..6133dd6 100644
--- a/tests/benchmarks/declarative/binding/data/objectproperty.txt
+++ b/tests/benchmarks/declarative/binding/data/objectproperty.txt
@@ -1,7 +1,7 @@
import Test 1.0
MyQmlObject {
- id: MyObject
+ id: myObject
result: ###
}
diff --git a/tests/benchmarks/declarative/binding/testtypes.h b/tests/benchmarks/declarative/binding/testtypes.h
index 4b103ce..523f94d 100644
--- a/tests/benchmarks/declarative/binding/testtypes.h
+++ b/tests/benchmarks/declarative/binding/testtypes.h
@@ -50,7 +50,7 @@ class MyQmlObject : public QObject
Q_PROPERTY(int result READ result WRITE setResult);
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged);
- Q_PROPERTY(QDeclarativeList<QObject *> *data READ data);
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data);
Q_CLASSINFO("DefaultProperty", "data");
public:
MyQmlObject() : m_result(0), m_value(0), m_object(0) {}
@@ -61,7 +61,7 @@ public:
int value() const { return m_value; }
void setValue(int v) { m_value = v; emit valueChanged(); }
- QDeclarativeList<QObject *> *data() { return &m_data; }
+ QDeclarativeListProperty<QObject> data() { return QDeclarativeListProperty<QObject>(this, m_data); }
MyQmlObject *object() const { return m_object; }
void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); }
@@ -71,7 +71,7 @@ signals:
void objectChanged();
private:
- QDeclarativeConcreteList<QObject *> m_data;
+ QList<QObject *> m_data;
int m_result;
int m_value;
MyQmlObject *m_object;
diff --git a/tests/benchmarks/declarative/binding/tst_binding.cpp b/tests/benchmarks/declarative/binding/tst_binding.cpp
index ee529a7..dbddac3 100644
--- a/tests/benchmarks/declarative/binding/tst_binding.cpp
+++ b/tests/benchmarks/declarative/binding/tst_binding.cpp
@@ -103,8 +103,8 @@ void tst_binding::objectproperty_data()
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("binding");
- QTest::newRow("object.value") << "data/objectproperty.txt" << "object.value";
- QTest::newRow("object.value + 10") << "data/objectproperty.txt" << "object.value + 10";
+ QTest::newRow("object.value") << SRCDIR "/data/objectproperty.txt" << "object.value";
+ QTest::newRow("object.value + 10") << SRCDIR "/data/objectproperty.txt" << "object.value + 10";
}
void tst_binding::objectproperty()
@@ -132,13 +132,13 @@ void tst_binding::basicproperty_data()
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("binding");
- QTest::newRow("value") << "data/localproperty.txt" << "value";
- QTest::newRow("value + 10") << "data/localproperty.txt" << "value + 10";
- QTest::newRow("value + value + 10") << "data/localproperty.txt" << "value + value + 10";
+ QTest::newRow("value") << SRCDIR "/data/localproperty.txt" << "value";
+ QTest::newRow("value + 10") << SRCDIR "/data/localproperty.txt" << "value + 10";
+ QTest::newRow("value + value + 10") << SRCDIR "/data/localproperty.txt" << "value + value + 10";
- QTest::newRow("MyObject.value") << "data/idproperty.txt" << "MyObject.value";
- QTest::newRow("MyObject.value + 10") << "data/idproperty.txt" << "MyObject.value + 10";
- QTest::newRow("MyObject.value + MyObject.value + 10") << "data/idproperty.txt" << "MyObject.value + MyObject.value + 10";
+ QTest::newRow("myObject.value") << SRCDIR "/data/idproperty.txt" << "myObject.value";
+ QTest::newRow("myObject.value + 10") << SRCDIR "/data/idproperty.txt" << "myObject.value + 10";
+ QTest::newRow("myObject.value + myObject.value + 10") << SRCDIR "/data/idproperty.txt" << "myObject.value + myObject.value + 10";
}
void tst_binding::basicproperty()
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp
index 9c0fd27..4319208 100644
--- a/tests/benchmarks/declarative/creation/tst_creation.cpp
+++ b/tests/benchmarks/declarative/creation/tst_creation.cpp
@@ -42,7 +42,7 @@
#include <qtest.h>
#include <QDeclarativeEngine>
#include <QDeclarativeComponent>
-#include <QDeclarativeMetaType>
+#include <private/qdeclarativemetatype_p.h>
#include <QDebug>
#include <QGraphicsScene>
#include <QGraphicsItem>
@@ -339,7 +339,8 @@ void tst_creation::itemtree_data_cpp()
for (int i = 0; i < 30; ++i) {
QDeclarativeItem *child = new QDeclarativeItem;
QDeclarativeGraphics_setParent_noEvent(child,item);
- item->data()->append(child);
+ QDeclarativeListReference ref(item, "data");
+ ref.append(child);
}
delete item;
}
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml
index 69114af..dc29f15 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml
@@ -1,6 +1,6 @@
import Qt 4.6
QtObject {
- id: Blah
+ id: blah
}
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml
index 723e62a..e48194a 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml
@@ -7,8 +7,8 @@ Item { id:block
property int targetX: 0
property int targetY: 0
- x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 }
- y: SpringFollow { source: targetY; spring: 2; damping: 0.2 }
+ SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 }
+ SpringFollow on y { source: targetY; spring: 2; damping: 0.2 }
Image { id: img
source: {
@@ -21,7 +21,7 @@ Item { id:block
}
}
opacity: 0
- opacity: Behavior { NumberAnimation { duration: 200 } }
+ Behavior on opacity { NumberAnimation { duration: 200 } }
anchors.fill: parent
}
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
index 12fa9f4..30ef235 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
@@ -7,6 +7,9 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp
HEADERS += testtypes.h
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
symbian* {
data.sources = data/*
data.path = data
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h
index 4b103ce..523f94d 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h
@@ -50,7 +50,7 @@ class MyQmlObject : public QObject
Q_PROPERTY(int result READ result WRITE setResult);
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged);
- Q_PROPERTY(QDeclarativeList<QObject *> *data READ data);
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data);
Q_CLASSINFO("DefaultProperty", "data");
public:
MyQmlObject() : m_result(0), m_value(0), m_object(0) {}
@@ -61,7 +61,7 @@ public:
int value() const { return m_value; }
void setValue(int v) { m_value = v; emit valueChanged(); }
- QDeclarativeList<QObject *> *data() { return &m_data; }
+ QDeclarativeListProperty<QObject> data() { return QDeclarativeListProperty<QObject>(this, m_data); }
MyQmlObject *object() const { return m_object; }
void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); }
@@ -71,7 +71,7 @@ signals:
void objectChanged();
private:
- QDeclarativeConcreteList<QObject *> m_data;
+ QList<QObject *> m_data;
int m_result;
int m_value;
MyQmlObject *m_object;
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index 7065303..4b1456e 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -90,13 +90,13 @@ void tst_qmlcomponent::creation_data()
{
QTest::addColumn<QString>("file");
- QTest::newRow("Object") << "data/object.qml";
- QTest::newRow("Object - Id") << "data/object_id.qml";
- QTest::newRow("MyQmlObject") << "data/myqmlobject.qml";
- QTest::newRow("MyQmlObject: basic binding") << "data/myqmlobject_binding.qml";
- QTest::newRow("Synthesized properties") << "data/synthesized_properties.qml";
- QTest::newRow("Synthesized properties.2") << "data/synthesized_properties.2.qml";
- QTest::newRow("SameGame - BoomBlock") << "data/samegame/BoomBlock.qml";
+ QTest::newRow("Object") << SRCDIR "/data/object.qml";
+ QTest::newRow("Object - Id") << SRCDIR "/data/object_id.qml";
+ QTest::newRow("MyQmlObject") << SRCDIR "/data/myqmlobject.qml";
+ QTest::newRow("MyQmlObject: basic binding") << SRCDIR "/data/myqmlobject_binding.qml";
+ QTest::newRow("Synthesized properties") << SRCDIR "/data/synthesized_properties.qml";
+ QTest::newRow("Synthesized properties.2") << SRCDIR "/data/synthesized_properties.2.qml";
+ QTest::newRow("SameGame - BoomBlock") << SRCDIR "/data/samegame/BoomBlock.qml";
}
void tst_qmlcomponent::creation()
diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
index 8070768..79fdd26 100644
--- a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
+++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
@@ -6,3 +6,5 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativemetaproperty.cpp
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
index dae1751..8a5f4ae 100644
--- a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
+++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
@@ -42,7 +42,7 @@
#include <qtest.h>
#include <QDeclarativeEngine>
#include <QDeclarativeComponent>
-#include <QDeclarativeMetaProperty>
+#include <QDeclarativeProperty>
#include <QFile>
#include <QDebug>
@@ -89,8 +89,8 @@ void tst_qmlmetaproperty::lookup_data()
{
QTest::addColumn<QString>("file");
- QTest::newRow("Simple Object") << "data/object.qml";
- QTest::newRow("Synthesized Object") << "data/synthesized_object.qml";
+ QTest::newRow("Simple Object") << SRCDIR "/data/object.qml";
+ QTest::newRow("Synthesized Object") << SRCDIR "/data/synthesized_object.qml";
}
void tst_qmlmetaproperty::lookup()
@@ -103,7 +103,7 @@ void tst_qmlmetaproperty::lookup()
QObject *obj = c.create();
QBENCHMARK {
- QDeclarativeMetaProperty p(obj, "x");
+ QDeclarativeProperty p(obj, "x");
}
delete obj;
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
index 61f5fc8..9dd4076 100644
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ b/tests/benchmarks/declarative/script/tst_script.cpp
@@ -96,11 +96,6 @@ private slots:
private:
};
-void tst_script::initTestCase()
-{
- QML_REGISTER_TYPE(Qt.test, 1, 0, TestObject, TestObject);
-}
-
inline QUrl TEST_FILE(const QString &filename)
{
return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
@@ -147,6 +142,12 @@ int TestObject::x()
return m_x++;
}
+void tst_script::initTestCase()
+{
+ QML_REGISTER_TYPE(Qt.test, 1, 0, TestObject, TestObject);
+}
+
+
#define PROPERTY_PROGRAM \
"(function(testObject) { return (function() { " \
" var test = 0; " \